我有一个团队,我们正在开展一个项目。我们的一个团队成员在GitHub上创建了一个存储库,并将其他人添加为合作者。我的团队成员将我们的代码提交到此存储库。我做了部分更改,当我尝试提交时,出现错误。我如何将更改提交给我是合作伙伴的存储库?Git:拒绝拒绝
这就是我所做的:
git remote add origin https://github.com/xxx/xxx.git (added a repository where I'm a collaborator)
`git push origin master
To https://github.com/xxx/xxx.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/xxx/xxx.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.
git pull origin master
warning: no common commits
remote: Counting objects: 145, done.
remote: Compressing objects: 100% (60/60), done.
remote: Total 145 (delta 67), reused 145 (delta 67), pack-reused 0
Receiving objects: 100% (145/145), 55.90 KiB | 0 bytes/s, done.
Resolving deltas: 100% (67/67), done.
From https://github.com/xxx/xxx
* branch master -> FETCH_HEAD
* [new branch] master -> or/master
fatal: refusing to merge unrelated histories
我只是想更新我的一部分,它提交到库。我没有我自己的存储库。
谢谢
* “警告:没有共同提交” * - 你都从一个空的回购开始?当然你有合适的遥控器? – jonrsharpe
我们在笔记本电脑上都有相同的代码。然后,我的会员创建了一个回购协议,并将所有代码提交给它。我对代码的一部分做了一些改动,现在我不能提交它(( – AnaF
)在尝试添加更改之前,您是否从该回购中获得了回报?如果您从代码的预回购版本开始,那么您需要克隆它*然后*添加你的变化 – jonrsharpe