cd /extend1/data/www/kb-new
git init
git add *
git commit -m "My initial commit message"
2, 在远程服务器上 (创建空的远程Git仓库)
sudo su - git
cd ~/repositories
mkdir kb-new.git
cd kb-new.git
git --bare init
备注:本人的Git Remote Repositories都在远程服务器git用户的~/repositories目录下。
3, 在本地机器上
a, 配置刚才建立的本地Git仓库跟踪远程Git仓库
cd /extend1/data/www/kb-new
git remote add origin git@XXX.XX.XX:kb-new.git
git push origin master
b, 建立远程跟踪分支
#Switch to origin/master so you don't get any error about "fatal: Cannot force update the current branch."
git checkout origin/master
#Create the local "master" branch that is tracking the "origin/master" branch
git branch -f master origin/master
#Switch back to your "master" branch
git checkout master