输入:git push -u origin master命令出现以下类似内容
Theauthenticity of host 'github.com (13.250.167.23)' can't be established.
RSAkey fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Areyou sure you want to continue connecting (yes/no)? no
Hostkey verification failed.
fatal:Could not read from remote repository.
Pleasemake sure you have the correct access rights
andthe repository exists.
解决:
git config –globaluser.email "[email protected]" 回车获取[email protected]
$ ssh-keygen -t rsa -C "[email protected]"
会出现
Generatingpublic/private rsa key pair.
Enterfile in which to save the key (/c/Users/mashuai/.ssh/id_rsa):
无视这些请继续直接按下回车
Enterpassphrase (empty for no passphrase):
Entersame passphrase again:
Youridentification has been saved in /c/Users/mashuai/.ssh/id_rsa.
Your public key has been saved in /c/Users/mashuai/.ssh/id_rsa.pub.
Thekey fingerprint is:
SHA256:PwMOjau2FfUgxY9u5r1UQ/WpzNkgxxtPazsaFdztukM“[email protected]
Thekey's randomart image is:
+---[RSA2048]----+
| .. . |
| .. ....+|
| . oo ..= =+|
| =.o..= X.o|
| +.S . o* *.|
| =+o . .E..|
| o+..= o.o |
| .o ...o +..|
| .o. .. ... |
+----[SHA256]-----+
之后打开提示的目录下(红色提示)用记事本打开id_rsa.pub,进入到自己的账号https://github.com/....../settings/keys/new,复制记事本内容到Key,无视Title即可
之后执行命令: git push -u origin master
仍出现如下:
ERROR:The key you are authenticating with has been marked as read only.
fatal:Could not read from remote repository.
Pleasemake sure you have the correct access rights
andthe repository exists.
解决:输入命令git pull--rebase origin master从远程分支进行拉取
会出现以下类似内容说明拉取成功
Warning:Permanently added the RSA host key for IP address '13.229.188.59' to the list of known hosts.
warning:no common commits
remote:Counting objects: 3, done.
remote:Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpackingobjects: 100% (3/3), done.
Fromgithub.com:maerqi/hello-world
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
First,rewinding head to replay your work on top of it...
最后在执行命令: git push-u origin master,出现类似以下内容
Countingobjects: 16, done.
Deltacompression using up to 4 threads.
Compressingobjects: 100% (15/15), done.
Writingobjects: 100% (16/16), 1.43 KiB | 489.00 KiB/s, done.
Total16 (delta 4), reused 0 (delta 0)
remote:Resolving deltas: 100% (4/4), done.
Togithub.com:maerqi/hello-world.git
da99626..ae02fd0 master -> master
Branch'master' set up to track remote branch 'master' from 'origin'.
说明已成功和远程仓库完美连接,该做什么事了你心里还不清楚吗
参考
https://blog.csdn.net/qq_34291777/article/details/55052201?locationNum=1&fps=1