1. install a git server & initialize a repositoryinstall git-core
$ apt-get install git-core
|
check the path of git-shell
$ which git-shell /usr/bin/git-shell
|
add some users which can access the git server via the git-shell
$ sudo useradd -m -s /usr/bin/git-shell git $ sudo passwd git (you can add more users as above)
|
initialize a git repository: foo
$ sudo mkdir /home/git/foo $ cd /home/git/foo $ git --bare init $ sudo chown -R git:git /home/git/foo
|
first commit(create the master branch)
$ mkdir foo $ cd foo $ git init $ touch README $ git add README $ git commit -m "added README" $ git remote add origin git@localhost:/home/git/foo $ git push origin master $ cd ..; rm -rf foo
|
2. using git as a clientfirstly, you also need to install git-core
clone the repository from the git server
$ git clone git@your-git-server:/home/git/foo
|
do a little configuration
$ cd foo $ git config --global user.name "git" $ git config --global user.email "git's email"
|
upgrade(synchronization)
add a new file or directory
$ touch file $ git add file
|
add some comments to the above operation
$ git commit -a -m "some comments here..."
|
submit your operation to the git server
that's all, have fun :-)
References & Links
[1] Remote Git Repos on Ubuntu: The Right Way
http://blog.drewolson.org/2008/05/remote-git-repos-on-ubuntu-right-way.html[2] Installing Git on a server (Ubuntu or Debian)
[3] Hosting Git repositories, The Easy (and Secure) Way
http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
阅读(2499) | 评论(0) | 转发(0) |