I have a bare git repository, but need to access and browse its contents over ssh (in a file manager like user experience).
I assume I could clone it:
git clone -l <path_to_bare_repo> <new_normal_repo>
However, my repository is about 20GB in size and I don't have the space to duplicate it. Is there a way to convert the bare repository in-place to end up with a working copy in it?
Note: I tested this on a very simple 1-commit repository. Double-check this, read the man pages, and always be happy you've backed up before following advice you found on StackOverflow. (You do back up, right?)
To convert a
--bare
repository to a non-bare:.git
folder in the top-level of your repository.HEAD branches config description hooks info objects refs
etc.) into the.git
you just created.git config --local --bool core.bare false
to convert the local git-repository to non-bare.master
(or whichever your main branch is) and all your files are deleted and the deletion is staged. That's normal. Just manually checkoutmaster
, or do agit reset --hard
, and you are done..git/config
file adding linefetch = +refs/heads/*:refs/remotes/origin/*
afterurl = <...>
in[remote "origin"]
section. Otherwisegit fetch
will not seeorigin/master
and other origin's branches.These steps are in the opposite direction of this question, "git-convert normal to bare repository" - in particular note this answer, which states that the above steps (in, I presume, either direction) is different from doing a
git-clone
. Not sure if that's relevant to you, though, but you mentionedgit clone
in the question.