【发布时间】:2020-10-31 16:51:43
【问题描述】:
我已完成所有步骤,但无法连接到远程存储库。
我将 ssh 密钥添加到我的 GitLab 帐户,但出现错误:
user@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
完整输出:
user@DESKTOP MINGW64 ~/Desktop/instabot (master)
$ ssh-keygen -t rsa -b 4096 -C "email@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/user/.ssh/id_rsa):
Created directory '/c/Users/user/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/user/.ssh/id_rsa
Your public key has been saved in /c/Users/user/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:xxxx email@gmail.com
The key's randomart image is:
+---[RSA 4096]----+
...
+----[SHA256]-----+
user@DESKTOP MINGW64 ~/Desktop/instabot (master)
$ git push origin master
The authenticity of host 'gitlab.com (...)' can't be established.
ECDSA key fingerprint is SHA256:....
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.com,...' (ECDSA) to the list of known hosts.
user@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
user@DESKTOP MINGW64 ~/Desktop/instabot (master)
$ git remote get-url
usage: git remote get-url [--push] [--all] <name>
--push query push URLs rather than fetch URLs
--all return all URLs
user@DESKTOP MINGW64 ~/Desktop/instabot (master)
$ git remote get-url origin
ssh://gitlab.com/myaccount/instabot.git
user@DESKTOP MINGW64 ~/Desktop/instabot (master)
$ eval `ssh-agent -s`
Agent pid 1189
【问题讨论】: