2012年7月11日 星期三

一步步架設 GIT server(1) --- GIT remote server through SSL

GIT 對 soho 的人來說非常適合, 因爲
1. 具有 local version control 的能力, 在開發的時候, 可以不必跟 server 作非常平凡的查詢.
2. 可以很輕易的開 branch, 同時有很嚴謹的 merge 管控

可是, 架設 GIT server 很複雜.我決定一步一步學習, 最後的目標
a. 架設 https 支援的 git server, 同時可以用 public-key 取代 password
b. 設定好 GitHub
c. 學習使用 repo

第一步 : 架好使用 SSH + 密碼登入的 git server
Server : my.remote.server
User : myname
Password : mypassword
Path : /home/myname/git-repo/

Source
Server : my.source.archive
Path : /home/myname/source-code/

Test Site

Server : my.test.site
Path : /home/myname/git-test/


Server 端 :
1. Login with myname
2. cd git-repo
3. git init --bare

Source 端 :
1. Login with myname
2. mkdir source-code-git
3. cd source-code-git
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
   type mypassword to pass
7. copy source code from ~/source-code/ to ~/source-code-git/
8. git add . ; git commit -m "Commit Message"
9. git push git-myrepo master

Test 端
1. Login with myname
2. mkdir my-git-test
3. cd my-git-test
4. git init
5. git remote add "git-myrepo" "ssh://myname@my.remote.server/~myname/git-repo"
6. git fetch git-myrepo
7. git checkout master

沒有留言: