简体   繁体   中英

Visual Studio - Git clone fails over SSH, but works over HTTPS

I am using a fresh install of Visual Studio 2017 (15.8.1), and Git tools. When I try to clone an existing GitHub repository, either by using the commandline tools, or by using git tools, I receive the following error message:

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

I believe this error is caused by SSH and I cannot seem to make git use HTTPS. Thanks in advance.

If you are using 2-factor authentication at GitHub

You must either do one of the following:

  1. Use the SSH link, add an SSH key to your GitHub account and load it using the SSH agent in Windows, this may be done using Putty.
  2. Generate a personal access token , and use the HTTPS link. Use your GitHub username as the username, but use the generated access token as your password.

If you want to clone any repository using https

Simply clone it using the HTTPS-link instead of the SSH link. You can find both links here, by clicking on Use SSH , you can switch to the SSH link:

SSH链接

就我而言,我必须删除〜/ .ssh / known_hosts文件,以便下次您通过ssh访问git时可以创建一个新文件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM