How do you set up a shared team repository?
How to set up a normal repository is described here -- but how do you set up a team repository that everybody can pull and push from and to?
Using a shared NFS file system
Assuming your team already has for instance a shared group membership that can be used.
mkdir /your/share/folder/project.git
cd /your/share/folder/project.git
newgrp yourteamgroup # if necessary
git init --bare --shared
To start using this repository the easiest thing to do is start from a local repository you already have been using:
cd your/local/workspace/project
git remote add origin /your/share/folder/project.git
git push origin master
Others can now clone this and start working:
cd your/local/workspace
git clone /your/share/folder/project.git
Using SSH
Set up a user account on the target server. Whether you use an account with no password, an account with a password, or use authorized_keys
really depend on your required level of security. Take a look at Configuring Git over SSH for some more information.
If all developers use the same account for accessing this shared repository, you do not need to use the --shared
option as above.
After initing the repository in the same way as above, you do the initial push like this:
cd your/local/workspace/project
git remote add origin user@server:/path/to/project.git
git push origin master
See the similarity with the above? The only thing that might happen in addition is SSH asking for a password if the account has a password. If you get this prompt on an account without a password the SSH server probably has disabled PermitEmptyPasswords
.
Cloning now looks like this:
cd your/local/workspace
git clone user@server:/path/to/project.git