How to remove subversion remote in git?

You can edit the .git/config file and remove the section associated with the remote you want to remove.

The lines you want to remove probably look roughly like this:

[svn-remote "svn"]
    url = url-of-svn-repository/trunk
    fetch = :refs/remotes/git-svn

This will remove the remote from Git, but you will still have the relationship between the Git commits and the SVN commits stored in .git/svn. You can remove this whole directory if you want to get rid of all your SVN remotes. If you want to get rid of just one SVN remote and keep others, you will need to look at the directory structure and only remove the ones associated with the remote you are removing.


Doing it via most *nix shells, bash or mingw32:

cd ~/your_repo
git config --remove-section svn

or whatever section you have when you view the config (cat .git/config). For example, the next line would remove the same config section described in Eric's solution:

git config --remove-section svn-remote.svn

next remove all svn stuff inside the .git folder (svn, logs, and refs). Which is also what Sergey suggests.

rm -rf .git/svn .git/{logs/,}refs/remotes/{git-,}svn/

garbage collection just for good measure:

git gc

source/credits


Eric's answer is correct, but not full. Even after Rafael Raposo's comment. I wish I could comment on the answer rather than posting a new one, but the rules are you can't comment until you reach 50 reputation.

The addition is:

find .git -type f -exec grep -nH git-svn "{}" \;

Showed me I had references in these two files:

./.git/info/refs:4:fd34a5c...8073f3 refs/remotes/git-svn
./.git/packed-refs:5:fd34a5...cd6c33 refs/remotes/git-svn

Until I removed those references, I could see git-svn doing git log


If you don't have any local config and you want to forego faffing about in the .git directory, simply clone the git repo from the git remote to a new directory and remove the old directory.

If you do have some simple local config (for example a different user/email to your global config), it's probably still easier to do this, and then restore any local config after cloning.