繁体   English   中英

Github 不允许我推送到分支

[英]Github won't allow me to push to branch

在尝试推送到回购时,我得到以下信息:

To https://github.com/Ekultek/whitewidow.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/Ekultek/whitewidow.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.

我很困惑为什么它不允许我推动?

让我们回顾一下我是如何到达这里的:

我更改了大约 300 行代码,已经拉取了另一个存储库,并且看到了整个>>>>>HEAD + >>>>>>324240283<random-numbers>东西。

但是,当我尝试它给我相同的输出时,我仍然无法推送:

C:\Users\Justin\myscripts\rubysql\whitewidow [master +2 ~1 -0 !]> git pull https://github.com/Ekultek/whitewidow
remote: Counting objects: 169, done.
remote: Compressing objects: 100% (30/30), done.
Receiving objects:  92% (156/169)   al 169 (delta 14), reused 3 (delta 3), pack-reused 136
Receiving objects: 100% (169/169), 56.76 KiB | 0 bytes/s, done.
Resolving deltas: 100% (86/86), completed with 2 local objects.
From https://github.com/Ekultek/whitewidow
 * branch            HEAD       -> FETCH_HEAD
warning: Cannot merge binary files: README.md (HEAD vs. 281bf372e265d81c0b020747e59eb7935c339d78)
Auto-merging whitewidow.rb
CONFLICT (content): Merge conflict in whitewidow.rb
Auto-merging log/non_exploitable.txt
CONFLICT (content): Merge conflict in log/non_exploitable.txt
Auto-merging log/error_log.LOG
CONFLICT (content): Merge conflict in log/error_log.LOG
Auto-merging log/SQL_VULN.LOG
CONFLICT (content): Merge conflict in log/SQL_VULN.LOG
Auto-merging lib/spider.rb
CONFLICT (content): Merge conflict in lib/spider.rb
Auto-merging lib/search_query.txt
CONFLICT (content): Merge conflict in lib/search_query.txt
Auto-merging lib/rand-agents.yaml
CONFLICT (content): Merge conflict in lib/rand-agents.yaml
Auto-merging lib/legal.rb
CONFLICT (content): Merge conflict in lib/legal.rb
Auto-merging lib/credits.rb
Auto-merging lib/copy.rb
Auto-merging docs/COPYRIGHT.md
CONFLICT (add/add): Merge conflict in docs/COPYRIGHT.md
Auto-merging docs/CHANGELOG.md
CONFLICT (add/add): Merge conflict in docs/CHANGELOG.md
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Auto-merging Gemfile
CONFLICT (add/add): Merge conflict in Gemfile
Automatic merge failed; fix conflicts and then commit the result.
C:\Users\Justin\myscripts\rubysql\whitewidow [master +5 ~2 -0 !9 | +5 ~1 -0 !9 !]> git push
To https://github.com/Ekultek/whitewidow.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/Ekultek/whitewidow.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.

回购中有一些新的变化,你不能只是推送,你首先需要拉新的变化,然后你不能推送。

另一方面,您可以执行 git push -f 来强制推送,但我认为您不想这样做.. :)

源存储库已更新,但您尚未更新本地存储库。 更新本地存储库的典型方法是使用命令git push <remote> <branch> ,如果您刚刚创建了存储库并且尚未创建任何分支或远程,那么您只需将git push origin master放入包含.git文件的目录中的命令行(gitbash 或 linux,不确定 Mac,不认为它可以在 Windows 上运行)。

如果您使用 GUI 工具来处理 git,那么通常会有一个显示“拉”的按钮。 单击此按钮,然后再次尝试推送。

您的远程存储库中有一些您的本地存储库没有的提交,并且您首先将其拉取。 我认为有人已将新提交推送到您的远程存储库,您必须先拉取它才能推送您的提交。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM