1. 建立本地仓库
#cd git
#git init
#echo Initialized empty Git repository in /home/git/.git > README
#git add README
#git commit -m "Initialized empty Git "
#git config --global user.name "kjfure"
#git config --global user.email "kjfure@163.com"
2. 关联本地仓库和远程仓库
mkdir gitcore.git
git init
cd git
git remote add origin root@192.168.1.102:~/gitcore.git
git push origin master
出现一些权限的错误:
fatal: Unable to create '/home/root/gitcore.git/refs/heads/master.lock': Permission denied
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
解决办法:
cd gitcore.git
chmod 777 objects/ -R
chmod 777 refs/ -R
3.一些操作
git status
git show 'commit id'
git log
git push <remote> <branch>
git pull
git branch
git checkout <branch>