未能将一些引用推送到 [email protected]:myapp.git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9831129/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
failed to push some refs to [email protected]:myapp.git
提问by Maven
I am getting this error when I am trying push my files into heroku rep. Ive tried following solutions but none helped:
当我尝试将文件推送到 heroku 代表时出现此错误。我试过以下解决方案,但没有任何帮助:
- this
- Tried
git pull heroku master
(results below) - Tried trying
git push heroku -f
(results below) - set autocrlf = false
- 这个
- 尝试过
git pull heroku master
(结果如下) - 尝试尝试
git push heroku -f
(结果如下) - 设置 autocrlf = false
Kindly guide me through this.
请指导我完成此操作。
Thank you
谢谢
C:\myapp>git init
Reinitialized existing Git repository in C:/myapp/.git/
C:\myapp>git add .
C:\myapp>git add -u
C:\myapp>git commit -m "ic"
# On branch master
nothing to commit (working directory clean)
C:\ myapp>git push heroku
To [email protected]:myapp.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:myapp.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
while trying git pull heroku master
在尝试时 git pull heroku master
warning: no common commits
remote: Counting objects: 215, done.
remote: Compressing objects: 100% (147/147), done.
remote: Total 215 (delta 82), reused 132 (delta 62)Receiving objects: 79% (170/
Receiving objects: 100% (215/215), 1.49 MiB | 107 KiB/s, done.
Resolving deltas: 100% (82/82), done.
From heroku.com:myapp
* branch master -> FETCH_HEAD
Auto-merging start.php
CONFLICT (add/add): Merge conflict in start.php
Auto-merging src/appinfo.txt
CONFLICT (add/add): Merge conflict in src/appinfo.txt
Auto-merging result.php
CONFLICT (add/add): Merge conflict in result.php
Auto-merging landhere.php
CONFLICT (add/add): Merge conflict in landhere.php
Automatic merge failed; fix conflicts and then commit the result.
while trying git push heroku -f
在尝试时 git push heroku -f
F:\myapp>git remote add heroku [email protected]:myapp.git
F:\myapp>git push heroku -f
Counting objects: 41, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (40/40), done.
Writing objects: 100% (41/41), 1.36 MiB | 12 KiB/s, done.
Total 41 (delta 0), reused 0 (delta 0)
-----> Heroku receiving push
! Heroku push rejected, no Cedar-supported app detected
To [email protected]:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:myapp.git'
回答by vmalloc
It seems like you indeed have merge conflicts with the upstream. I suggest the following:
看起来您确实与上游存在合并冲突。我建议如下:
1.run git fetch origin
2.run git log ..origin/master
to see what's new in the original that you still don't have. Note that 'git push -f' will override these commits if you attempt it...
3.run git pull --rebase
(this might again fail with merge conflicts). After a successful pull and rebase your push should work. I would, however, pay close attention to those merge conflicts since it seems in your case they stem from a garbled history (maybe a previous merge/rebase gone awry?)
4.If all else fails, create a new branch, pointing at the origin/master (git checkout -b new_master origin/master
), and then, using git-log
and git-cherry-pick
- fish out the only commits that are truly new in relation to origin/master. Then push this new branch and archive the old master.
1.运行git fetch origin
2.运行git log ..origin/master
以查看原始版本中您仍然没有的新内容。请注意,如果您尝试,'git push -f' 将覆盖这些提交...
3.运行git pull --rebase
(这可能会再次因合并冲突而失败)。成功拉取和重新设置后,您的推送应该可以工作。但是,我会密切关注那些合并冲突,因为在您的情况下,它们似乎源于乱码的历史(也许之前的合并/变基出错了?)
4.如果所有其他方法都失败了,请创建一个新分支,指向origin/master ( git checkout -b new_master origin/master
),然后,使用git-log
和git-cherry-pick
- 找出与 origin/master 相关的唯一真正新的提交。然后推送这个新分支并归档旧的 master。
Assuming the above four ways all fail, there might be a problem on the remote repository.
假设以上四种方式都失败,可能是远程仓库有问题。