gpt4 book ai didi

git - 无法将一些引用推送到 git@heroku.com :myapp. git

转载 作者:行者123 更新时间:2023-12-01 22:42:37 25 4
gpt4 key购买 nike

当我尝试将我的文件推送到 heroku rep 时出现此错误。我尝试了以下解决方案,但都没有帮助:

  1. > this
  2. 尝试了 git pull heroku master(结果如下)
  3. 尝试了 git push heroku -f(结果如下)
  4. 设置autocrlf = false

请指导我完成这个。

谢谢

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 git@heroku.com:myapp.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com: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.

尝试 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.

尝试 git push heroku -f

F:\myapp>git remote add heroku git@heroku.com: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 git@heroku.com:myapp.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:myapp.git'

最佳答案

看来您确实与上游存在 merge 冲突。我建议如下:

1. 运行 git fetch origin

2. 运行git log ..origin/master 以查看原始文件中您还没有的新内容。请注意,如果您尝试“git push -f”将覆盖这些提交...

3. 运行 git pull --rebase(这可能再次因 merge 冲突而失败)。成功 pull 并重新设置基准后,您的推送应该会起作用。但是,我会密切注意那些 merge 冲突,因为在您的情况下,它们似乎源于乱码的历史记录(也许以前的 merge/ rebase 出错了?)

4. 如果一切都失败了,创建一个新的分支,指向 origin/master (git checkout -b new_master origin/master),然后,使用 git-loggit-cherry-pick - 找出与 origin/master 相关的唯一真正新的提交。然后推送这个新分支并归档旧的master。

假设以上四种方式都失败,则可能是远程仓库有问题。

关于git - 无法将一些引用推送到 git@heroku.com :myapp. git,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9831129/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com