Git Failes推送一些参考,更新被拒绝

时间:2015-10-14 18:13:42

标签: git github push

我尝试推送更改时收到此消息。如何合并我的本地存储库和远程存储库?我复制了项目文件夹并做了:

git init

git remote add Myprojectname path-to-my-project.git
git commit -a -m "msg"

git pull origin master

git push origin mybranch

我收到了这个错误:

Git Failes to push some refs, Updates were rejected because the tip of your current branch is behind its remote changes.

如何解决这个问题?提前谢谢!

1 个答案:

答案 0 :(得分:1)

为什么要添加遥控器? git remote add Myprojectname path-to-my-project.git。据我所知,您应该在添加github项目时添加git remote add origin path-to-my-project.git。请使用此命令Myprojectnamegit remote rm myproject删除git remote rm origin远程,并添加git remote add origin https://github.com/user/repo.git之类的遥控器。然后你可以拉动它。顺便说一下,在这种情况下你不必指定原点,只需git push

相关问题