Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
151 views
in Technique[技术] by (71.8m points)

git - What is the url for a full github repo?

I am trying to clone my entire github repo onto a new machine. On the website, the url looks something like this:

https://github.com/MyName

However, when I do this:

git clone https://github.com/MyName C:/Users/MyName/Documents/GitHub/

I get

>Cloning into GitHub 'C:/Users/MyName/Documents/GitHub/'
>fatal: repository 'https://github.com/MyName' not found
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

https://github.com/MyName would be the URL for an account, not a repo. For instance, jQuery (the company) has an account at https://github.com/jquery. If I try to clone from that URL, I get a clone error:

git clone https://github.com/jquery
>>> Cloning into 'jquery'...
>>> fatal: repository 'https://github.com/jquery' not found

Which makes sense - that URL isn't of a repository.

Meanwhile, if I actually clone the project, https://github.com/jquery/jquery, it works:

git clone https://github.com/jquery/jquery.git
>>> Cloning into 'jquery'...
>>> remote: Counting objects: 36035, done.
>>> remote: Compressing objects: 100% (91/91), done.
>>> remote: Total 36035 (delta 60), reused 0 (delta 0), pack-reused 35944
>>> Receiving objects: 100% (36035/36035), 21.72 MiB | 2.77 MiB/s, done.
>>> Resolving deltas: 100% (25434/25434), done.
>>> Checking connectivity... done.

If you want to clone all the repos under a username, there isn't a native way to do that. However, clone-all or github-clone seem to fit the bill as tools that'll do this for you.

The general procedure that you would need to do (by hand or with a tool) would be:

  1. Get a list of URLS containing all repos for an org/user.
  2. Clone each of theme using git clone.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...