有人可以帮我解决以下问题:我从教授Git url中克隆了数据,并尝试将我的私人帐户设置为上游主机,并将代码推送到我的私人存储库(https://github.com/accountid/reponame')中。
[当我git checkout -b branchname
时,它是在我的教授存储区中创建一个新分支,而不是在我的帐户中,我想在我的私人存储区中创建一个母版。
但是我收到以下错误:
[rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/accountid/reponame'
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.
我如何推送到我的私有存储库?
您只需要阅读错误消息。
如果本地分支没有最新消息,则不能将(除非使用强制-f
)推到远程存储库。
读取错误,您将看到需要在推之前执行拉。
# pull changes from the server
git pull
# If you have conflicts resolve them and if not simply push to the server
# Assuming your remote is the origin
git push origin <branch>
当我
git checkout -b branchname
时,它将在我的教授回购不在我的帐户中]中创建一个新分支。我想在我的私人回购中创建一个母版。如果存储库不在您的帐户下,并且您不是贡献者,则需要先对其进行分叉。
首先,检查原点指向: