Skip to content

Instantly share code, notes, and snippets.

@Demacr
Created October 13, 2020 15:16
Show Gist options
  • Save Demacr/e0630ff3f24c6128f3e448aa31369662 to your computer and use it in GitHub Desktop.
Save Demacr/e0630ff3f24c6128f3e448aa31369662 to your computer and use it in GitHub Desktop.

To convert a --bare repository to a non-bare:

  • Make a .git folder in the top-level of your repository.
  • Move the repository management things (HEAD branches config description hooks info objects refs etc.) into the .git you just created.
  • Run git config --local --bool core.bare false to convert the local git-repository to non-bare.
  • (via comment by Tamás Pap) After step #3 you will see that you are on branch master (or whichever your main branch is) and all your files are deleted and the deletion is staged. That's normal. Just manually checkout master, or do a git reset --hard, and you are done.
  • (to resolve issue reported by Royi) Edit .git/config file adding line fetch = +refs/heads/:refs/remotes/origin/ after url = <...> in [remote "origin"] section. Otherwise git fetch will not see origin/master and other origin's branches.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment