2010年6月26日 星期六

git repository

In this document, you will learn how to build up a remote server repository

#Server side

-Server proj dir: wcli@ep.cs.nthu.edu.tw/home/wcli/proj1/
-proj1/ contains all of my project contents

Step 1:
Copying the whole project content to a git bare repo. The git bare repo is a directory which contains only the git database. To set up a repository on a server you should clone the existing Factor repository using the '--bare' option:

Example:


$cd to proj1/
$git init
$git clone --bare wcli@ep.cs.nthu.edu.tw:/home/wcli/proj1/.git proj1.git
$Moving the proj1.git to the dir you want, say /home/wcli/proj1.git

Then proj1.git is the bare git database which of proj1

#User side
Step 1:
$clone the repo
$git clone wcli@ep.cs.nthu.edu.tw:/home/wcli/proj1.git

Then proj1 will be cloned to the position you resided.

Step 2:
$cd to proj1
$modify a file
$git add .
$git commit -m "test"
$git push wcli@ep.cs.nthu.edu.tw:/home/wcli/myVM.git

Then the modified file will be pushed to the server side

#Another user side

Sync with the server

$cd to the proj1
$git pull

sync successfully

usage:

delete file exists on repo server
git rm
git commit -m "comment"
git push push wcli@ep.cs.nthu.edu.tw:/home/wcli/myVM.git

ref:
1. http://www.bluishcoder.co.nz/2007/09/how-to-publish-git-repository.html

沒有留言:

張貼留言