当存储库中存在其他人所做的提交时,如何在 github 中推送提交

问题描述 投票:0回答:1

我已经尝试过:
git 添加 .
git commit -m“提交”
git 推送
git拉

结果:

(venv) PS C:\Users\hp\desktop\job> git push
To https://github.com/Dbtzhv/leasing_bot.git
 ! [rejected]        main -> main (fetch first)
error: failed to push some refs to 'https://github.com/Dbtzhv/leasing_bot.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.
(venv) PS C:\Users\hp\desktop\job> git pull
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 5 (delta 3), reused 5 (delta 3), pack-reused 0
Unpacking objects: 100% (5/5), 1.71 KiB | 51.00 KiB/s, done.
From https://github.com/Dbtzhv/leasing_bot
   31e2f42..66c1990  main       -> origin/main
warning: Cannot merge binary files: db.sqlite3 (HEAD vs. 66c19903b6b3de76d0ba7cbed1593b0e57c4c79a)
Auto-merging db.sqlite3
CONFLICT (content): Merge conflict in db.sqlite3
Automatic merge failed; fix conflicts and then commit the result.
(venv) PS C:\Users\hp\desktop\job> git push
To https://github.com/Dbtzhv/leasing_bot.git
 ! [rejected]        main -> main (non-fast-forward)
error: failed to push some refs to 'https://github.com/Dbtzhv/leasing_bot.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.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

如何推动我的提交? Git pull 没有帮助我
问题是我的数据库存在冲突,但我不知道如何解决它,我该怎么办?

git github gitlab git-push
1个回答
0
投票

在这里,您必须首先对分支执行

git pull
,以将您的分支与其他用户提交同步。 如果存在任何冲突,您必须手动解决冲突,然后尝试提交并推送更改。

您也可以先提交更改,但如果没有

git pull
,则无法推送更改。

如果不合并更改之前推送的最新更改,就无法推送更改。

© www.soinside.com 2019 - 2024. All rights reserved.