Obtains a local copy of a remote Git repository.
Questions tagged [git-clone]
1121 questions
4370
votes
42 answers
How to clone all remote branches in Git?
I have a master and a development branch, both pushed to GitHub. I've cloned, pulled, and fetched, but I remain unable to get anything other than the master branch back.
I'm sure I'm missing something obvious, but I have read the manual and I'm…
![](../../users/profiles/117.webp)
Peter Coulton
- 50,723
- 11
- 51
- 70
3389
votes
7 answers
How do I clone a specific Git branch?
Git clone will behave copying remote current working branch into local.
Is there any way to clone a specific branch by myself without switching branches on the remote repository?
![](../../users/profiles/207419.webp)
Scud
- 36,193
- 6
- 23
- 18
2529
votes
20 answers
How do you clone a Git repository into a specific folder?
Executing the command git clone git@github.com:whatever creates a directory in my current folder named whatever, and drops the contents of the Git repository into that folder:
/httpdocs/whatever/public
My problem is that I need the contents of the…
![](../../users/profiles/78642.webp)
David Smith
- 33,190
- 10
- 40
- 60
2009
votes
15 answers
Download a specific tag with Git
I'm trying to figure out how I can download a particular tag of a Git repository - it's one version behind the current version.
I saw there was a tag for the previous version on the git web page, with object name of something long hex number.
But…
![](../../users/profiles/64895.webp)
Jack BeNimble
- 33,194
- 33
- 113
- 187
1595
votes
25 answers
Git push requires username and password
I cloned a Git repository from my GitHub account to my PC.
I want to work with both my PC and laptop, but with one GitHub account.
When I try to push to or pull from GitHub using my PC, it requires a username and password, but not when I'm using…
![](../../users/profiles/650574.webp)
TooCooL
- 17,593
- 6
- 26
- 42
1577
votes
20 answers
How do I clone a subdirectory only of a Git repository?
I have my Git repository which, at the root, has two sub directories:
/finisht
/static
When this was in SVN, /finisht was checked out in one place, while /static was checked out elsewhere, like so:
svn co…
![](../../users/profiles/22468.webp)
Nick Sergeant
- 29,184
- 12
- 34
- 44
869
votes
22 answers
How do I clone a single branch in Git?
I have a local Git repository called 'skeleton' that I use for storing project skeletons. It has a few branches, for different kinds of projects:
casey@agave [~/Projects/skeleton] git branch
* master
rails
c
c++
If I want to check out the…
![](../../users/profiles/66450.webp)
Casey Rodarmor
- 12,867
- 5
- 28
- 31
837
votes
10 answers
Are Git forks actually Git clones?
I keep hearing people say they're forking code in Git. Git "fork" sounds suspiciously like Git "clone" plus some (meaningless) psychological willingness to forgo future merges. There is no fork command in Git, right?
GitHub makes forks a little…
![](../../users/profiles/790054.webp)
Brian
- 8,523
- 3
- 12
- 8
629
votes
17 answers
How to convert a normal Git repository to a bare one?
How can I convert a 'normal' Git repository to a bare one?
The main difference seems to be:
in the normal Git repository, you have a .git folder inside the repository containing all relevant data and all other files making up your working copy
in a…
![](../../users/profiles/113195.webp)
Boldewyn
- 75,918
- 43
- 139
- 205
544
votes
22 answers
How to get Git to clone into current directory
I'm doing:
git clone ssh://user@host.com/home/user/private/repos/project_hub.git ./
I'm getting:
Fatal: destination path '.' already exists and is not an empty
directory.
I know path . already exists.
And I can assure that directory IS empty.…
![](../../users/profiles/378170.webp)
MEM
- 27,721
- 40
- 115
- 190
531
votes
7 answers
What's the difference between git clone --mirror and git clone --bare
The git clone help page has this to say about --mirror:
Set up a mirror of the remote repository. This implies --bare.
But doesn't go into detail about how the --mirror clone is different from a --bare clone.
![](../../users/profiles/121828.webp)
Sam
- 12,476
- 6
- 24
- 38
509
votes
5 answers
What are the differences between git branch, fork, fetch, merge, rebase and clone?
I want to understand the difference between a branch, a fork and a clone in Git?
Similarly, what does it mean when I do a git fetch as opposed to a git pull?
Also, what does rebase mean in comparison to merge?
How can I squash individual commits…
![](../../users/profiles/394880.webp)
jackiekazil
- 5,593
- 4
- 18
- 20
431
votes
15 answers
How to clone git repository with specific revision/changeset?
How can I clone git repository with specific revision, something like I usually do in Mercurial:
hg clone -r 3 /path/to/repository
![](../../users/profiles/421182.webp)
John
- 4,313
- 3
- 13
- 4
322
votes
3 answers
How to git-svn clone the last n revisions from a Subversion repository?
Problem
How do you create a shallow copy with git-svn from a Subversion repository, e.g. how do you pull only the last three revisions?
The git clone command can get the last n revisions from a Git repository if you use the option --depth, i.e. you…
![](../../users/profiles/33311.webp)
Lernkurve
- 17,488
- 24
- 77
- 110
299
votes
2 answers
Is it safe to shallow clone with --depth 1, create commits, and pull updates again?
The --depth 1 option in git clone:
Create a shallow clone with a history truncated to the specified number of revisions. A shallow repository has a number of limitations (you cannot clone or fetch from it, nor push from nor into it), but is…
![](../../users/profiles/623519.webp)
artfulrobot
- 17,987
- 10
- 41
- 66