Reputation:
I have the .git
directory, but I do not have the actual working directory, just the repo. What command can I use to recreate the working directory?
Upvotes: 8
Views: 1735
Reputation: 28015
I think you are actually asking how to make a bare repository non bare. While it is probably the easiest just to clone it again, this also works:
First make sure that all the internal git files (e.g. index, HEAD) and folders (e.g. hooks, info, objects, refs) are in a folder named .git. That's probably not the case now that your repository is still bare. So just rename it. Then move that into the folder that you want to become your working directory.
And then on the working directory level:
git config core.bare 0
git checkout -f
However, it's more easy to just clone again ;-)
Upvotes: 1
Reputation: 25855
If what you need is not a working repository to work with, but merely a copy of the working files, you can run git archive
on the .git
directory to generate a Tar file from the working tree.
It is normally produced on stdout, so you can simply run git --git-dir=/path/to/repo archive | tar x
to get a copy in your working directory.
Upvotes: 2
Reputation: 13753
Let's say the .git dir is in an otherwise empty directory called "test."
git clone test new_test
new_test will now contain the .git directory and a working copy. Alternatively, you can also point directly to the .git directory:
git clone test/.git new_test
with the same result.
Upvotes: 12