顯示具有 git 標籤的文章。 顯示所有文章
顯示具有 git 標籤的文章。 顯示所有文章

2016/10/11

Just a Note:Use GIT as SVN Client

2016.10.03 補充:
略過不要 fetch 的目錄。

當團隊中有人使用非 Windows 系統時,可能會發生 svn 中出現 Windows 無法接受的字元的目錄,
即使事後刪除了,但這樣的資訊仍會存在 history 中。

若此時使用 git svn 進行 fetch,便會發生無法建立目錄的錯誤。
此時可以透過 sparse checkout 避開這樣的目錄,具體步驟如下:

1. git config core.sparseCheckout true
2. 查看 .git/info 目錄下是否有 sparse-checkout 檔案,若無,新增一個。
3. 在檔案中加入
/*
!不要的目錄路徑

4. 重新執行 git svn rebase 或 git svn fetch

5. 即使加了上述的設定,在 git svn rebase 時,還是會有問題,此時就必須額外加上 --ignore-paths 忽略有問題的路徑:
git svn clone some_svn_url . -s --prefix=svn/ --ignore-paths="^(?:trunk|branches|tags)/不要的路徑"
git svn rebase --ignore-paths="^(?:trunk|branches|tags)/不要的路徑"


沒想到已經三年沒寫筆記了......

2015/11/22

Just a Note:Simple Git Server on Windows (Using git daemon)

As Server

f:
md reop
cd repo
git init --bare xxxx.git
git daemon --verbose --base-path=f:/repo --export-all --enable=receive-pack



  • --verbose:開啟詳細 log,加了之後除錯比較方便。
  • --base-path=f:/repo:告訴 deamon 你的 git repository 統一放在哪個目錄下,可以在此目錄下建立不同的 git repository。以上述的例子,就是 xxxx.git 的父目錄。
  • --export-all:允許 pull base path 下所有的 git repository
  • --enable=receive-pack:開放匿名存取,目前還沒研究怎麼在 git daemon 裡做 access control。

As Client

git config --global sendpack.sideband false

  • Client 要設定此參數,在 push 時才不會 hang 住。

git clone git://yourserver/xxxx.git

  • git://yourserver 便會指到 daemon 的 base path,後面的 xxxx.git 就是在 base path 下建立的 git repository。