Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Git clone doesn't download all the branches?

eiger3970 May 29, 2014

Hi,

In Terminal, I navigated to my local computer's folder where I would like the remote repository pulled down to.

I typed $ git clone https://repositoryUserName@repositoryWebsite/teamName/repositoryName.git> Enter > here's the code that I received. I can't navigate to my branch with the files I would like to work on?

Cloning into 'localComputerFolderForRepositoryFiles'...

Password for 'https://bitbucketusername@bitbucket.org': 

remote: Counting objects: 136, done.

remote: Compressing objects: 100% (125/125), done.

remote: Total 136 (delta 43), reused 0 (delta 0)

Receiving objects: 100% (136/136), 540.92 KiB | 241 KiB/s, done.

Resolving deltas: 100% (43/43), done.

south-11-141: Folder for remote repository files localComputerUsername$ ls

localFolderWithDownloadedRepositoryFiles

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ cd localFolderWithDownloadedRepositoryFiles/

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ ls

README.md

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ git branch -a

* master

  remotes/origin/HEAD -> origin/master

  remotes/origin/user1s_branch

  remotes/origin/master

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ cd ..

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ ls

localFolderWithDownloadedRepositoryFiles

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ cd ..

south-11-141:localComputerParentFolder localComputerUsername$ ls

Backups

Notes.txt

Random

localComputerFolderForRepositoryFiles

south-11-141:localComputerUsername$ cd localComputerFolderForRepositoryFiles

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ ls

localFolderWithDownloadedRepositoryFiles

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ git branch -a

fatal: Not a git repository (or any of the parent directories): .git

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ ls

localFolderWithDownloadedRepositoryFiles

south-11-141:localComputerFolderForRepositoryFiles localComputerUsername$ cd localFolderWithDownloadedRepositoryFiles/

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ ls

README.md

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ git branch -a

* master

  remotes/origin/HEAD -> origin/master

  remotes/origin/user1s_branch

  remotes/origin/master

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ git checkout remotes/origin/user1s_branch

Note: checking out 'remotes/origin/user1s_branch'.

 

You are in 'detached HEAD' state. You can look around, make experimental

changes and commit them, and you can discard any commits you make in this

state without impacting any branches by performing another checkout.

 

If you want to create a new branch to retain commits you create, you may

do so (now or later) by using -b with the checkout command again. Example:

 

  git checkout -b new_branch_name

 

HEAD is now at e8a7752... sqlTest.v7.py deleted online with Bitbucket

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ git branch -a

* (no branch)

  master

  remotes/origin/HEAD -> origin/master

  remotes/origin/user1s_branch

  remotes/origin/master


3 answers

1 accepted

0 votes
Answer accepted
eiger3970 June 5, 2014

I think the problem was the exact syntax needed to switch to the branch.

Example 1:

Normally, the command

$ git branch -a

shows the branches in this format:

master

user1s_branch

user2s_branch

Example 2:

However I was confused when the command

$ git branch -a

showed the branches in this format:

master

remotes/origin/HEAD -> origin/master

remotes/origin/user1s_branch

remotes/origin/master

remotes/origin/user2s_branch

I was then trying to change from master branch to user1s_branch with command

$ git checkout user1s_branch

which worked on example 1 when I first started Bitbucket.

However with example 2, I thought I had to type the command

$ git checkout remotes/origin/user1s_branch

This was the problem, I need to also type the command

$ git checkout user1s_branch

0 votes
eiger3970 May 29, 2014

I made a new folder on the local computer: localComputerFolderForRepositoryFilesv2 and git clone does the same error?

0 votes
eiger3970 May 29, 2014

I tried again.

Same error. The problem for me is:

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ git branch -a
 
* (no branch)
 
  master
 
  remotes/origin/HEAD -> origin/master
 
  remotes/origin/user1s_branch
 
  remotes/origin/master

I need to access the user1s_branch and cannot. I used to be able to access the branch with $ git checkout user1s_branch.

south-11-141:localFolderWithDownloadedRepositoryFiles localComputerUsername$ git checkout /remotes/origin/user1s_branch
fatal: Could not switch to '/remotes/origin': No such file or directory

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events