Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does git:// works but git@ does not

Tags:

git

github

Why does git:// works

$ git clone git://github.com/schacon/grit.git
Cloning into 'grit'...
...
Checking connectivity... done.

but git@ does not

$ git clone [email protected]:schacon/grit.git mygrit
Cloning into 'mygrit'...
Warning: Permanently added the RSA host key for IP address '192.30.252.129' to t
he list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

Any help is appreciated

like image 395
Haibin Liu Avatar asked Feb 03 '14 16:02

Haibin Liu


People also ask

Why is my git clone not working?

Make sure that the path in the git clone call is correct. If you have an authorization error, have an administrator check the ACLs in Administration > Repositories > <repoName> > Access. Have an administrator check the bare repo in the GitCentric storage directory.

How do I fix a fatal Not a git repository?

To do so, you need to navigate to the correct folder and then run the command git init , which will create a new empty Git repository or reinitialize an existing one.

Why does GitHub refuse to connect?

Most often, connection problems occur because a firewall, proxy server, corporate network, or other network is configured in a way that blocks GitHub.


2 Answers

This is because git@ uses ssh protocol. It is equivalent to ssh://git@.. So if you dont have correct ssh keys it will not work. Option git:// however uses git protocol which is similar to ssh but uses no authentication at all. See chapter on protocols for more information.

like image 171
lonelyelk Avatar answered Sep 29 '22 06:09

lonelyelk


Your first clone method is using the git protocol, the second is using SSH.

You probably don't have your SSH token setup on github.com

https://help.github.com/articles/generating-ssh-keys

Gives you the steps on how to setup your user account for SSH use.

You can see the differences between the protocols as they pertain to github here:

https://gist.github.com/grawity/4392747

like image 26
sjakubowski Avatar answered Sep 29 '22 08:09

sjakubowski