While reading the tutorials I keep hearing that I need to create something known as a bare repository for sharing all the files in the repo.
When you git push
to a remote repository, you can overwrite the files in the working directory
. To avoid this, you can use a bare
repository, which doesn't even have a working directory
.
However, because there's no working directory
, you can't work in the bare
repo, you can only push
to it and pull
from it. This makes it ideal as a "collection point" or "collaboration repo" for multiple users -- which is why the git
tutorials say to use a bare
repository for servers.
A normal git
repo looks like this:
my-repository/
.git/
COMMIT_EDITMSG
ORIG_HEAD
description
index
objects
FETCH_HEAD
branches
gitk.cache
info
refs
HEAD
config
hooks
logs
file1
file2
my-repository
is the working directory
, containing the files you work on file1
, file2
etc. All the git
data is stored in the .git
folder.
On a bare
repository, you don't have a working folder. All you have is the contents of the .git
folder, stored in the top-level of that repository:
my-bare-repository/
COMMIT_EDITMSG
ORIG_HEAD
description
index
objects
FETCH_HEAD
branches
gitk.cache
info
refs
HEAD
config
hooks
logs
This is what other users clone.