mkdir gitrepo chown harriszh:harriszh /home/harriszh/gitrepo git init --bare /home/harriszh/gitrepo/memtrans.git
git clone --bare memtrans memtrans.git
git init git add . git commit -m "first commit" git remote add origin harriszh@sj-harriszh:/home/harriszh/gitrepo/memtrans.git git push -u origin master
默認每次都要輸入密碼git
能夠配置默認的branchbash
[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = harriszh@sj-harriszh:/home/harriszh/gitrepo/memtrans.git fetch = +refs/heads/*:refs/remotes/origin/* [branch "master"] remote = origin merge = refs/heads/master
修改repo文件的讀寫執行權限服務器
chmod g+wx /home/harriszh/gitrepo/memtrans.git
客戶端每次修改時先git pull
從服務器端拉回最新修改再進行修改和git push
, 這樣能夠減小不少衝突fetch