Can't clone repo using git clone git://… - ok with git clone http://

半世苍凉 提交于 2019-12-23 07:43:50

问题


Git newbie here. I'm setting up git on a new Ubuntu VM and trying to clone some repos. The clone works for the following command:

git clone http://github.com/organisation_name/repo_name

(after prompt for username/password), but fails for

git clone git://github.com/organisation_name/repo_name

and also

git clone git://github.com/organisation_name/repo_name.git

with the same error message:

Cloning into 'repo_name'...
fatal: remote error:
Repository not found

Of course the obvious answer is "use the http method", but I'm trying to understand why one works and the other doesn't. Any suggestions? (also is there any difference when using the .git extension on the repo name btw?)

Thanks!


回答1:


Well, I think you are using the wrong url in your second case

Try this instead

git clone git@github.com:organisation_name/repo_name.git

The difference is the : in the url when using git@ vs the / you are currently using, and the extra .git at the end.

This should be the same url if you go to github and select the ssh url for cloning (and not the https one selected by default)




回答2:


If this is a private repository, you need to add your machine's ssh public key to you account under https://github.com/settings/ssh otherwise you will get the exact error you are listing here.




回答3:


I just wanted to throw out there that my problem was the network. All of my settings were good. I was told the network didn't filter or block ports or anything, but after trying everything I could think of and everything I could find online; I finally tethered my laptop to my mobile phone and everything started working just fine.




回答4:


Query: why HTTPS URL works and SSH URL doesn't?
The purpose of SSH URLs is to provide access to a Git repository via SSH, a secure protocol. To use these URLs, you must generate an SSH keypair on your computer and add the public key to your GitHub account.



来源:https://stackoverflow.com/questions/19683557/cant-clone-repo-using-git-clone-git-ok-with-git-clone-http

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!