1. 程式人生 > >git遇到的問題:Please make sure you have the correct access rights and the repository exists.解決方案

git遇到的問題:Please make sure you have the correct access rights and the repository exists.解決方案

輸入: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