git 报错:Permanently added the RSA host key for IP address ‘13.229.188.59’ to the list of known hosts.

emmmmmm 报错信息是这样的

$ git push -u origin master
Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.
To github.com:magicmshing/Tm.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:magicmshing/Tm.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.

嗯嗯,报错信息有点多啊,,,
先看第一条Warning: Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.叫我们把那个地址添加添加到本地。
那就添加呗

linux的话,就在 /etc/hosts添加:

# set github
13.229.188.59 github.com

windows的话就编辑/c/Windows/System32/drivers/etc/hosts文件

也是添加一样的内容

记住无论是linux还是windows都需要管理员权限才能修改

再次运行

$ git push -u origin master
To github.com:magicmshing/Tm.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:magicmshing/Tm.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.

还是有报错,嗯嗯,本人是个英语渣,慢慢吭。

嗯嗯,经过我漫长的百度之后,发现貌似是创建库的时候我写了一个README.md的Markdown文件

解决: 把仓库下拉到本地,在上传

$ git pull --rebase origin master
From github.com:magicmshing/Tm
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
First, rewinding head to replay your work on top of it...
Applying: first commit my wechat miniprogram

然后再继续上传

$ git push -u origin master
Enumerating objects: 33, done.
Counting objects: 100% (33/33), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (31/31), done.
Writing objects: 100% (32/32), 92.32 KiB | 153.00 KiB/s, done.
Total 32 (delta 5), reused 0 (delta 0)
remote: Resolving deltas: 100% (5/5), done.
To github.com:magicmshing/Tm.git
   c4c56ce..0dbd8a6  master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.

就成功了。我这应该只是坑之一,也只是解决的方法之一。

相关文章

发表评论

您的电子邮箱地址不会被公开。