Why does “git svn fetch” command seem to be stuck

2020-02-08 03:58发布

EDIT: Workaround. Now we understand the issue, here is the solution: do

git svn fetch -r REVISION:HEAD

where REVISION is the number of the svn commit of the branch creation.


I've been happy using git svn to work on the trunk of my project for a while, but now I need to track branches also.

I've tried to initialize a new repository to do that with

git init
git svn init https://svnserver/svn/repository

Then I edit the local configuration file to reflect the structure of my svn repository:

[svn-remote "svn"]
    url = https://svnserver/svn/repository
    fetch = path/to/trunk:refs/remotes/trunk
    branches = path/to/branches/*:refs/remotes/branches/*

Then I run

git svn fetch

And this command just does nothing:

  • It does not terminates
  • It does not write anything in the console output
  • It does not use any CPU, nor create files

I gave up after 10 minutes

I've checked that the svn repository is working, because git svn fetch works perfectly on my git repository where I track only the trunk.

Is this a bug or am I missing something here ?

标签: git git-svn
5条回答
虎瘦雄心在
2楼-- · 2020-02-08 04:27

In case of using Git for Windows, make sure to upgrade from 2.20.1 to either previous (2.20.0), next (2.21.0) or any other. Mentioned version has a bug making "git svn fetch" hang, which was later fixed.

查看更多
够拽才男人
3楼-- · 2020-02-08 04:35

For those who were not satisfied with the solution above :

ISSUE : svn+ssh://svn.xxxxxxx.com/svnroot/strategy/products/mysoftware hangs on :

Initialized empty Git repository in [MyLocalRepositoryPath]

SOLUTION: Insert

username@

in front of svn url

svn+ssh://username@svn.xxxxxxx.com/svnroot/strategy/products/mysoftware

查看更多
趁早两清
4楼-- · 2020-02-08 04:40

It becomes verbose after fetching the first relevant commit.

But until it fetches that commit, you can ensure the command is working properly by checking the .git\svn\.metadata file.

查看更多
神经病院院长
5楼-- · 2020-02-08 04:42

i have change the fetch property to :refs/remotes/git-svn and it works for me

查看更多
ゆ 、 Hurt°
6楼-- · 2020-02-08 04:49

Try adding the --log-window-size=5000 parameter.

If the repo has a large number of commits, git-svn will go through them 100 at a time by default. Bumping that up can increase its speed tremendously.

查看更多
登录 后发表回答