Reputation: 131
Git: Clone
in Visual Studio Code on a mac returns Permission denied, please try again
. From terminal within Visual Studio Code it works to perform git clone
.
In Visual Studio Code on a Mac, I do the following:
Git: Clone
I input the ssh repository URL that is in the following format: ssh://<username>@<repository-host>/<path>/<rep>.git
I "Select Repository Location" folder, and get the following dialog:
This function never asks me for any password!
If I open the Git Log the output is this:
> 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.
In terminal it works:
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.
Any clues on why Git: Clone
Visual Studio Code never asks for the server password?
Upvotes: 1
Views: 7382
Reputation: 131
Underlaying functionality in Git: Clone
does not seem to have any interaction with the user after setting the repository URL and choosing the destination folder.
To get a ssh-repository to work with Visual Studio Code you need to do the following:
ssh-keygen
to generate ssh key pairssh-copy-id -i ~/.ssh/id_rsa <username>@<repository-host>
Derived from this question and this answer.
VS Code User Guide on Version Control has the following question/answer under Common Questions:
Can I use SSH Git authentication with VS Code? Yes, though VS Code works most easily with SSH keys without a passphrase. If you have a SSH key with a passphrase, you'll need to launch VS Code from a Git Bash prompt to inherit its SSH environment.
Upvotes: 1