Skip to content

Instantly share code, notes, and snippets.

@alhoqbani
Last active February 23, 2018 05:25
Show Gist options
  • Select an option

  • Save alhoqbani/6bc542384560aa42bc623f5214402da8 to your computer and use it in GitHub Desktop.

Select an option

Save alhoqbani/6bc542384560aa42bc623f5214402da8 to your computer and use it in GitHub Desktop.
Clone a remote git repository with all branches and tags

Create a folder for the repo.

mkdir ~/Desktop/repo && cd ~/Desktop/repo

Clone the remote repo as a bare repository to .git directory insdie the repo directory.

git clone --bare git@github.com:user/repo.git .git # <-- notice the extra .git

Convert the repo to a regular repo

git config --bool core.bare false

Reset the repo

git reset --hard

Now, you have the remote branches and tags in the local repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment