setting up a GIT repo

# on the git server
yum install git
groupadd git
useradd user1 -G git
useradd user2 -G git
mkdir /opt/git/repo1.git
chgrp -R git /opt/git/repo1.git
chmod -R 2775 /opt/git/repo1.git
cd /opt/git/repo1.git
git init --bare

# on the workstation (when creating an entirely new repo only)
yum install git
mkdir ~/repo1
cd ~/repo1
git init
git remote add origin ssh://user1@10.137.7.175/opt/git/repo1.git
git branch --set-upstream-to=origin/master master
touch abc.txt
git add .
git commit -m "first commit"
git push

# on the subsequent workstation (that works on the same repo)
cd ~
git clone ssh://user2@10.137.7.175/opt/git/repo1.git
git pull
touch cde.txt
git add .
git commit -m "my commit'
git push

No comments: