| by Scott Kilroy | No comments

Git – A better way to manage git with multi-users

Create a directory to store all your repos.  I like putting them in /var/git-repos

cd into /var/git-repos (or whatever you called it)
mkdir PROJECT_NAME.git
cd PROJECT_NAME.git
git init --bare

Then
Each user works locally (could be on their own system or could be in a personal directory on the same server).
Run the following:
mkdir PROJECT_NAME
cd PROJECT_NAME
git init

if working on the same server you could use
git remote add origin /var/git-repos/PROJECT_NAME.git

if working remotely you could use
git remote add origin USER_NAME@SERVER_NAME:var/repos/PROJECT_NAME.git

Then after that all you need to do to send your code to the main repo is run
git push -u origin master

**** OR (this one seems to work the best) ****
just go one directory up from where you created PROJECT_NAME and run
git clone PATH_TO_REPO PROJECT_NAME

Share Button