我尝试推送更改时收到此消息。如何合并我的本地存储库和远程存储库?我复制了项目文件夹并做了:
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.
如何解决这个问题?提前谢谢!
答案 0 :(得分:1)
为什么要添加遥控器? git remote add Myprojectname path-to-my-project.git
。据我所知,您应该在添加github项目时添加git remote add origin path-to-my-project.git
。请使用此命令Myprojectname
和git remote rm myproject
删除git remote rm origin
远程,并添加git remote add origin https://github.com/user/repo.git
之类的遥控器。然后你可以拉动它。顺便说一下,在这种情况下你不必指定原点,只需git push