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
?
No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.
# 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 ...
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.
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:
As others have suggested, just delete the entire Git repository and start again.
Again, as Chronial suggested, delete the bit of the Git config that's duff. Two ways to do this:
Use the git config
command:
git config --remove-section svn-remote.svn
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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With