vscode clone repository 到本地pull 出错

vscode clone repository: 打开cmd,cd 到folder,执行 git clone repository_url
提示输入rsa_password
download repository 到本地。
 
clone 到本地之后,pull 一下,出错:
git pull
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
 
Please make sure you have the correct access rights
and the repository exists.
 
是因为ssh key不匹配。
 
解决:
cd 到 git bin 目录,执行 ssh-keygen -t rsa -C"email_url"
生成新的ssh key,如果有提示输入密码的,直接回车就好。
 
C:\Program Files\Git\usr\bin> ssh-keygen -t rsa -C"[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/ADMIN/.ssh/id_rsa):
/c/Users/ADMIN/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):(直接回车)
Enter same passphrase again:(直接回车)
Your identification has been saved in /c/Users/ADMIN/.ssh/id_rsa.
Your public key has been saved in /c/Users/ADMIN/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:YpdvfdvfdvfjkCQE6SqsaNCwvwxFAEgAZmghwznj8IGO+xug [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|#=. . |
|BB . . |
|B+O . |
|==o+ . + |
|oC . + C + |
|B.+ . C = |
|*=. + . |
|++ |
|.E |
+----[SHA256]-----+
 
然后到 ssh 目录
 
 
拷贝id_rsa.pub 内容,
打开github ,到setting页面
 
new 一个新的ssh key ,把从id_rsa.pub 拷贝的内容复制到此处。

猜你喜欢

转载自www.cnblogs.com/imagin/p/9236273.html
今日推荐