Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 607
BaltoStar Avatar asked Mar 06 '13 22:03

BaltoStar


People also ask

Can I use Git and SVN at the same time?

No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.

How do I clone a SVN code?

# Clone a repo with standard SVN directory layout (like git clone): git svn clone http://svn.example.com/project --stdlayout --prefix svn/ # Or, if the repo uses a non-standard directory layout: git svn clone http://svn.example.com/project -T tr -b branch -t tag --prefix svn/ # View all branches and tags you have ...

What does git SVN clone do?

The git svn clone command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.


2 Answers

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.

like image 198
me_and Avatar answered Oct 06 '22 10:10

me_and


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
like image 21
Chronial Avatar answered Oct 06 '22 08:10

Chronial