Git clone doesn't download all the branches?

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

This widget could not be displayed.

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

This widget could not be displayed.

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

This widget could not be displayed.

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

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

179 views 18 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you