I have a git repository that was originally created using git-svn. Now I have a git server that I push to and the svn repository has been lost. Can I remove the svn remote? How?
What is Git-SVN? The git-svn tool is an interface between a local Git repository and a remote SVN repository. Git-svn lets developers write code and create commits locally with Git, then push them up to a central SVN repository with svn commit-style behavior.
No interaction between them. Just ignore the . git folder for SVN and the . svn folder for Git and you should be fine.
This retrieves all the changes from the SVN repository and applies them on top of your local commits in your current branch. This works like, you know, a rebase between two branches :) You can also use git svn fetch to retrieve the changes from the SVN repository but without applying them to your local branch.
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
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