您的位置:首页 > 理论基础 > 计算机网络

在github上传项目遇到的问题(error: failed to push some refs to 'https://github.com/CrazyDony/text.git')

2016-07-21 17:17 826 查看

在命令行中输入:

echo  "# text" >>README.md

git init

git add README.md

git commit -m "first commit"

git remote add origin https://github.com/CrazyDony/text.git
git push -u origin master

会出现以下错误

error: failed to push some refs to 'https://github.com/CrazyDony/text.git'

hint: Updates were rejected because the remote contains work that you do

hint: not have locally. This is usually caused by another repository pushing

hint: to the same ref. You may want to first integrate the remote changes

hint: (e.g., 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

出现错误的主要原因是github中的README.md文件不在本地代码目录中,

命令行中输入:


git pull--rebase origin master

git push -u origin master

然后又会出现



error: failed to push some refs to 'https://github.com/CrazyDony/text.git'

hint: Updates were rejected because a pushed branch tip is behind its remote

hint: counterpart. Check out this branch and integrate the remote changes

hint: (e.g. 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.


命令输入:

git push origin master

出现


failed to push some refs to 'https://github.com/CrazyDony/text.git'

hint: Updates were rejected because the tip of your current branch is behind

hint: its remote counterpart. Integrate the remote changes (e.g.

hint: 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.


原因:[b]自己分支版本低于主版本
[/b]

[b]git push -u origin master-f[/b]

Counting objects: 35, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (29/29), done.

Writing objects: 100% (35/35), 10.15 KiB | 0 bytes/s, done.

Total 35 (delta 5), reused 0 (delta 0)

To https://github.com/CrazyDony/text.git
 + aa70966...f64b22a master -> master (forced update)

Branch master set up to track remote branch master from origin. 完成.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: