我有一個團隊,我們正在開展一個項目。我們的一個團隊成員在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