Saturday, December 15, 2012

Setup remote Git repository

suppose the remote server is
suppose the repository is xxx.git

1. set up remote git repository
$mkdir ~/git-rep
$cd ~/git-rep
$mkdir xxx.git
$cd xxx.git
$git init --bare

2. on your local machine, add a remote repository aliases
$git remote add [ALIASES_NAME]
# check
$git remote -v

3. push your copy to the remote repository
# check branch
$git branch
$git push [ALIASES_NAME] master

4. Undo git add before the first commit
$git rm -r --cached .

5. repo inside a repo
$git submodule add [URL]
$git submodule init
$git submodule update

if you got an error: "bash: git-receive-pack: command not found", try
$git push [ALIASES_NAME] master --receive-pack=[REMOTE_PATH]/git-receive-pack

to avoid it, dump enviroment in .ssh/environment
env > .ssh/environment

Please note that setting up PATH in either .bashrc and .bash_profile does NOT work!

No comments:

Post a Comment