[git-svn] Change svn repo URL

SC Tuan
1 min readAug 30, 2019

--

不幸遇到需要改變 svn remote repository 的 url。好不容易找到別人提供的方法,記錄如下:

  1. 先把專案中的 .git/config 裡面的 svn-remote 的 url 改成新的連結。
  2. 執行 git svn fetch ,拉取最新的內容。
  3. 換回原先的 url
  4. 執行 git svn rebase -l ,做 local rebase。 -l 意思是在 local 做 rebase ,而不從 remote 抓取最新的進度。
  5. 再換回新的 url
  6. 執行 git svn rebase

順帶說明一下,一開始我在改變 url 後直接執行 git svn rebase ,得到一個錯誤訊息:

Unable to determine upstream SVN information from working tree history

所以,1~4就是讓 local 能對得上 remote 。最後再透過 6 把 local-remote 對上。

--

--

SC Tuan
SC Tuan

Written by SC Tuan

iOS developer(Obj-C & Swift) / Web developer (Java, Javascript, CSS,HTML)

No responses yet