跳过正文
  1. Blogs/

关于Git推送的一些问题

·450 字·1 分钟· loading · loading · ·
Git 博客
柴西
作者
柴西
记住也好,记不住也好,反正名头不重要。

git推送博客被拒绝解决办法。

Last login: Fri Dec 15 19:44:37 on ttys001

kai@luoriyehuitaopaodeMacBook-Air public % git add .

kai@luoriyehuitaopaodeMacBook-Air public % git commit -m “添加博客”

[main 2f869c8] 添加博客

238 files changed, 1016 insertions(+), 1085 deletions(-)

create mode 100644 js/hb.dc6e5c341be0d336877c41a5ce0bdbaf546a1aca0927f2fa3533c36e751145fd.js

kai@luoriyehuitaopaodeMacBook-Air public % git push

To https://github.com/runofftheearth/runofftheearth.github.io.git

! [rejected] main -> main (fetch first)

错误:无法推送一些引用到 ‘ https://github.com/runofftheearth/runofftheearth.github.io.git'

提示:更新被拒绝,因为远程仓库包含您本地尚不存在的提交。这通常是因为另外

提示:一个仓库已向该引用进行了推送。如果您希望先与远程变更合并,请在推送

提示:前执行 ‘git pull’。

提示:详见 ‘git push –help’ 中的 ‘Note about fast-forwards’ 小节。

kai@luoriyehuitaopaodeMacBook-Air public % git pull

remote: Enumerating objects: 4, done.

remote: Counting objects: 100% (4/4), done.

remote: Compressing objects: 100% (2/2), done.

remote: Total 3 (delta 1), reused 1 (delta 0), pack-reused 0

展开对象中: 100% (3/3), 692 字节 | 115.00 KiB/s, 完成.

来自 https://github.com/runofftheearth/runofftheearth.github.io

8235344..128a0cf main -> origin/main

Merge made by the ‘ort’ strategy.

CNAME | 1 +

1 file changed, 1 insertion(+)

create mode 100644 CNAME

kai@luoriyehuitaopaodeMacBook-Air public %

在遇到更新被远程仓库拒绝时输入

git pull origin main

会弹出一个窗口提示请输入一个提交信息以证明合理性。

关于Git推送的一些问题01

英文输入法下i,此时可以输入此次提交信息。

关于Git推送的一些问题02

然后按Esc,接着输入**:wq**即可。以后再更新博客推送就不会再遇见这类问题,当然再遇见采取上述步骤即可。不推荐使用git push -u origin main -f,用完这条命令相当于删除全部内容并重新上传,需要重新绑定域名。

相关文章

四 Hugo主题Blowfish添加友链
·648 字·2 分钟· loading · loading
博客
三 为博客添加搜索功能
·961 字·2 分钟· loading · loading
博客
二 图床选择
·1394 字·3 分钟· loading · loading
博客