Git: Clone
返回Permission denied, please try again
。从Visual Studio Code的终端可以执行git clone
。
在Mac上的Visual Studio Code中,我执行以下操作:
Git: Clone
我输入以下格式的ssh存储库URL:ssh://<username>@<repository-host>/<path>/<rep>.git
我“选择存储库位置”文件夹,并显示以下对话框:
此功能从不要求我输入任何密码!
如果我打开Git日志,则输出为:
> git clone <ssh-repository-URL> <path>
Cloning into '<path>'...
Permission denied, please try again.
Permission denied, please try again.
Received disconnect from <IP> port 22:2: Too many authentication failures for <username>
Disconnected from <IP> port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
在终端中有效:
mac:rep username$ git clone
Cloning into '<repository>'… <ssh-repository-URL>
The authenticity of host ‘<repository-host> (<repository-ip>)' can't be established.
ECDSA key fingerprint is SHA256:<fingerprint>.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '<repository-host>,<repository-ip>' (ECDSA) to the list of known hosts.
Password:
remote: ...
remote: ...
remote: …
Receiving objects: 100% (.../...), ... | ... MiB/s, done.
Resolving deltas: 100% (.../...), done.
关于Git: Clone
为什么Visual Studio Code从不要求输入服务器密码的任何线索?
答案 0 :(得分:0)
设置存储库URL并选择目标文件夹后,Git: Clone
中的底层功能似乎与用户没有任何交互。
要使ssh存储库与Visual Studio Code一起使用,您需要执行以下操作:
ssh-keygen
生成ssh密钥对ssh-copy-id -i ~/.ssh/id_rsa <username>@<repository-host>
《 VS Code版本控制用户指南》在“常见问题”下有以下问题/答案:
Can I use SSH Git authentication with VS Code? 是的,尽管VS Code最容易在没有密码的情况下使用SSH密钥。如果您有带有密码短语的SSH密钥,则需要从Git Bash提示符启动VS Code来继承其SSH环境。