Obtains a local copy of a remote Git repository.
Questions tagged [git-clone]
1359 questions
                    
                    4732
                    
            votes
                
                48 answers
            
        How do I clone all remote branches?
My master and development branches are tracked remotely on GitHub. How do I clone both these branches?
         
    
    
        Peter Coulton
        
- 54,789
- 12
- 54
- 72
                    3997
                    
            votes
                
                137 answers
            
        Message 'src refspec master does not match any' when pushing commits in Git
I clone my repository with:
git clone ssh://xxxxx/xx.git 
But after I change some files and add and commit them, I want to push them to the server:
git add xxx.php
git commit -m "TEST"
git push origin master
But the error I get back is:
error: src…
         
    
    
        sinoohe
        
- 40,334
- 3
- 19
- 16
                    3922
                    
            votes
                
                7 answers
            
        How do I clone a specific Git branch?
Git clone will clone remote branch into local.
Is there any way to clone a specific branch by myself without switching branches on the remote repository?
         
    
    
        Scud
        
- 41,923
- 8
- 26
- 18
                    2981
                    
            votes
                
                20 answers
            
        How do I clone a Git repository into a specific folder?
The command git clone git@github.com:whatever creates a directory named whatever containing a Git repository:
./
    whatever/
        .git
I want the contents of the Git repository cloned into my current directory ./ instead:
./
    .git
         
    
    
        David Smith
        
- 38,044
- 11
- 44
- 61
                    2103
                    
            votes
                
                16 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…
         
    
    
        Jack BeNimble
        
- 35,733
- 41
- 130
- 213
                    1972
                    
            votes
                
                31 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…
         
    
    
        Nick Sergeant
        
- 35,843
- 12
- 36
- 44
                    1846
                    
            votes
                
                30 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…
         
    
    
        TooCooL
        
- 20,356
- 6
- 30
- 49
                    1008
                    
            votes
                
                27 answers
            
        How do I clone a single branch in Git?
I have a local Git repository in ~/local_repo. It has a few branches:
$ git branch
* master
  rails
  c
  c++
To clone the local repository, I do:
$ git clone ~/local_repo new_repo
Initialized empty Git repository in…
         
    
    
        Casey Rodarmor
        
- 14,878
- 5
- 30
- 33
                    863
                    
            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…
         
    
    
        Brian
        
- 8,791
- 3
- 15
- 9
                    680
                    
            votes
                
                18 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…
         
    
    
        Boldewyn
        
- 81,211
- 44
- 156
- 212
                    663
                    
            votes
                
                8 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.
         
    
    
        Sam
        
- 14,642
- 6
- 27
- 39
                    643
                    
            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.…
         
    
    
        MEM
        
- 30,529
- 42
- 121
- 191
                    522
                    
            votes
                
                20 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
         
    
    
        John
        
- 5,223
- 3
- 16
- 4
                    518
                    
            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…
         
    
    
        jackiekazil
        
- 5,696
- 4
- 21
- 20
                    496
                    
            votes
                
                7 answers
            
        How to clone a specific Git tag
From git-clone(1) Manual Page
--branch can also take tags and detaches the HEAD at that commit in the resulting repository.
I tried  
git clone --branch  
But it does not work. It returns:  
warning: Remote branch 2.13.0 not…  
         
    
    
        Jiang Jun
        
- 5,245
- 3
- 16
- 13