Git 推送无效
Git push is not working
我正在尝试在 github 上推送本地存储库,但 git push
对我不起作用以下是错误
git push https://github.com/MandarSant/Mandars_First_Repo.git master
To https://github.com/MandarSant/Mandars_First_Repo.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/MandarSant/Mandars_First_Repo.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.
发生的事情是其他人已经推送到 master 而你在本地没有这些更改
从 master 拉取,将他们的更改与您的更改合并,然后您可以推送
如果每次有人没有阅读错误消息我都能得到一毛钱...
您需要 git pull
,然后才能 git push
在将任何内容推送到 git 存储库之前,您需要执行 git pull
命令。
如果有时可能会通知您某些文件将被合并覆盖,在这种情况下,您必须存储更改或将这些文件复制到另一个地方,然后必须还原更改,然后在拉取后应用您的更改。
正如错误消息所说,您尝试推送到的存储库已被其他人修改。为了能够推送到存储库,您应该有最新的更改。
所以您要做的就是确保您告诉 git,您知道其他人所做的更改。方法是做一个git pull
。完成后,您应该能够推送到存储库。
我正在尝试在 github 上推送本地存储库,但 git push
对我不起作用以下是错误
git push https://github.com/MandarSant/Mandars_First_Repo.git master
To https://github.com/MandarSant/Mandars_First_Repo.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/MandarSant/Mandars_First_Repo.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.
发生的事情是其他人已经推送到 master 而你在本地没有这些更改
从 master 拉取,将他们的更改与您的更改合并,然后您可以推送
如果每次有人没有阅读错误消息我都能得到一毛钱...
您需要 git pull
,然后才能 git push
在将任何内容推送到 git 存储库之前,您需要执行 git pull
命令。
如果有时可能会通知您某些文件将被合并覆盖,在这种情况下,您必须存储更改或将这些文件复制到另一个地方,然后必须还原更改,然后在拉取后应用您的更改。
正如错误消息所说,您尝试推送到的存储库已被其他人修改。为了能够推送到存储库,您应该有最新的更改。
所以您要做的就是确保您告诉 git,您知道其他人所做的更改。方法是做一个git pull
。完成后,您应该能够推送到存储库。