woo4

woo4

Advertisements

Setup Your Own Git Server In 5 Minutes

Sometimes, we need to build up a small project together with our co-workes.
But the modules in this project are highly dependent, it might takes much time to integrate our codes.
It’s a good idea to create a simple git server to help to handle that annoying work.

First, login our remote server, and then create a git user:
# ssh root@REMOTE_SERVER
# sudo adduser git
# exit

Secondly, login as git, create a repository
# ssh git@REMOTE_SERVER
# mkdir test.git
# cd test.git
# git --bare init
# exit

Now, you can commit your local codes to the remote git server
# mkdir test
# cd test
# git init
# touch README
# git add README
# git commit -m "first commit"
# git remote add origin git@REMOTE_SERVER:test.git
# git push origin master

Finally, ask your co-worker to clone it!
# git clone git@REMOTE_SERVER:test.git