I have to access some files stored in a Git repository, but I don't see where they are stored inside the repository folder.
Is there a special way to access the various files pushed from the clients?
I have to access some files stored in a Git repository, but I don't see where they are stored inside the repository folder.
Is there a special way to access the various files pushed from the clients?
If this is a bare repo, you wouldn't find those file in the repo.git
folder.
See "all about "bare" repos": a bare repo has no working tree, and is used for pushing to it (since there is no working tree to keep in sync with an updated branch)
The easiest way to see those file is to clone said bare repo:
git clone /path/to/repo.git /path/to/repo
I know only a hack-ish way to see the list of files in a bare repository without cloning:
GIT_DIR=/path/to/bare.git git log --pretty=format: --name-only --diff-filter=A
You most probably want to sort that output and exclude blank lines:
GIT_DIR=/path/to/bare.git git log --pretty=format: --name-only --diff-filter=A | sort | grep .
Viewing the content of a file is pretty clean though:
GIT_DIR=/path/to/bare.git git show HEAD:path/to/file
If you want to get specific files out of the bare repository but not entire repository, you could redirect the output of git show
to a file.
Btw, GIT_DIR=... git cmd
is equivalent to git --git-dir=... cmd
Git repositories are often stored on the server as a bare repository. This is effectively the contents of the normal .git
directory, and does not include an extracted working copy.
To access files stored in such a repository I recommend cloning the repository. If you want to do this from the server you can do something like git clone file /path/to/bare/repository /path/to/clone
.