I can’t clone repository with git bash

Asked

Viewed 1,758 times

2

I wonder why I can’t clone a public Github repository with git bash. I give the command git clone plus ssh or https, but gives the following message:

Permission denied (publickey).
Fatal: Could not read from remote.

Please make sure you have the correct access Rights and the Repository exists.

  • 1

    You have set up an SSH key?

  • I didn’t set up @LINQ

  • How is the beginning of the URL you are using to clone the project?

2 answers

6


If the repository is public and is giving this problem, you can use the HTTPS URL to clone.

Instead of using

git clone [email protected]:phplegends/sysv.git

use

git clone https://github.com/phplegends/sysv.git

Usually when using the url ssh, you need to configure the key. In the case of HTTPS, it is not necessary.

See below.

Selecionar a url HTTPS no GITHUB

Just click the "Use HTTP" button and copy the url. Then use the command git clone.

Remarks: On Github, when using the repository’s HTTPS url, for git clone, git pull and related, password is not required. But for data sending command, such as git push, you need to type authenticate yourself.

2

For those who are not getting even with ssh or https, Github’s own website provides help, just look in the guide on clone and you’ll find the commands to be made in git. I’ll leave the commands ready there, any questions go to the Github guide.

These commands should be done in the Git terminal. To test whether SSH on the HTTPS port is possible, run this SSH command:

$ ssh -T -p 443 [email protected]

Hello username! You were able to authenticate, but Github was not provides shell access. If it worked, great! Otherwise, follow our troubleshooting guide.

Enable SSH connections over HTTPS

If you can SSH on [email protected] on port 443, replace SSH settings to force any Github connection to run on that server and on that port.

To set this in the SSH configuration, edit the file in ~/.ssh/config and add this section:

Host github.com
  Hostname ssh.github.com
  Port 443

To test if it works, connect once more to Github:

$ ssh -T [email protected]

Hello username! You were able to authenticate, but Github does not provide shell access.

Okay, try these commands and it will definitely work.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.