GitHub for Windows : how to unset svn-remote.svn.url
Asked Answered
C

2

9

From cmd line at path for my local repo, I executed git svn clone command but with the wrong url.

I then tried to execute git svn clone with the correct url, but I can't because it tells me "svn-remote.svn.url already set"

How can I unset svn-remote.svn.url ?

Confraternity answered 6/3, 2013 at 22:18 Comment(1)
can you just do it in a different folder?Bernardinabernardine
E
9

The error you're getting isn't massively helpful. svn-remote.svn.url refers to part of your Git configuration, which is stored in a couple of different files; this bit is in .git/config at the root of your repository.

There're a few different options for fixing this up:

  1. As others have suggested, just delete the entire Git repository and start again.

  2. Again, as Chronial suggested, delete the bit of the Git config that's duff. Two ways to do this:

    1. Use the git config command:

      git config --remove-section svn-remote.svn
      
    2. Editing the .git/config file yourself. If you open it up in a text editor, you'll find a bit that looks like this, which you'll want to delete:

      [svn-remote "svn"]
              url = http://duff.path/to/repo
              fetch = trunk:refs/remotes/svn/trunk
              branches = branches/*:refs/remotes/svn/*
              tags = tags/*:refs/remotes/svn/tags/*
      

    Since your URL was duff, you won't have any remote branches. If you had once made a successful git svn fetch/git svn clone, you'd need to worry about keeping the branches you had safe, or deleting them sensibly, but that's not a problem here.

    Either of the above steps will leave you as if you'd never run git svn clone, and you can start afresh.

  3. If the only thing wrong with your git svn clone command was the URL, you can just fix it up. As above, you can do this using git config:

    git config svn-remote.svn.url http://correct.path/to/repo
    

    or by editing .git/config by hand and correcting the paths.

    Once that's corrected, you can just run git svn fetch to finish the cloning.

Enchant answered 7/3, 2013 at 16:37 Comment(0)
S
1

I would recommend deleting the repo and just recreating it again. If you have own branches in there, I would recommend cloning the repo and working on the clone. That way you get rid of all the git-svn data.

If you want to try and fix your repo instead, run this command to unset the svn-remote stuff:

git config --remove-section svn-remote
Stodge answered 7/3, 2013 at 0:24 Comment(3)
Interesting. So how would I remove the section [remote "tempclone"] ?Confraternity
git config --remove-section remote.tempcloneStodge
+1 for deleting and re-creating. Definitely the cleanest way, especially if this was the initial clone.Distinguish

© 2022 - 2024 — McMap. All rights reserved.