When checking out an SVN repository which gives a HTTP 301 (Moved Permanently), svn doesn't
follow the redirect but rather requires the user to do so manually and quite with exit code 1:
# checkout with SVN
$ LANG=C svn co http://remotefoo localfoo
svn: Repository moved permanently to 'https://remotefoo'; please relocate
As inconvenient as this might be, changing http to https then does the trick.
Now, when checking out the same repository using git-svn, an empty repository is created,
but then git-svn recognises the same issue and quits without cleaning up the unusable git repo:
# checkout with git-svn
$ LANG=C git svn clone http://remotefoo/ localfoo
Initialized empty Git repository in /tmp/localfoo/.git/
Repository has been moved: Repository moved permanently to 'https://remotefoo/'; please relocate at /usr/lib/git-core/git-svn line 1494
# checkout with git-svn using HTTPS then
$ LANG=C git svn clone https://remotefoo/ localfoo
svn-remote.svn.url already set: http://remotefoo
wanted to set to: https://remotefoo
# ok didn't work, maybe we can make something out of the broken local repository?
# git svn switch doesn't seem to exist after all...
$ cd localfoo; git svn rebase
fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
log --no-color --first-parent --pretty=medium HEAD: command returned error: 128
# try initialising by hand
$ git svn init https://remotefoo
svn-remote.svn.url already set: http://remotefoo
wanted to set to: https://remotefoo
# it doesn't want to touch the git-svn "url" in .git/config, same like above
# just for fun, try initialising with wrong HTTP url again
$ git svn init http://remotefoo
Remote ref refs/remote/git-svn is tracked by
"svn-remote.svn.fetch=:refs/remotes/git-svn"
and
"svn-remote.svn.fetch=:refs/remotes/git-svn"
Please resolve this ambiguity in your git configuration file before continuing
# ok, so this time it adds a second git-svn "fetch" to .git/config which doesn't make any sense whatsoever
There are two ways out of this: Removing the localfoo directory and starting again
with HTTPS, or manually changing the git-svn "url" in .git/config and calling
git svn fetch. The latter should be done automatically by git-svn in this case
for the convenience of the user, ideally even automatically when recognising
the 301 message from svn, but otherwise at least when re-cloning with the
updated HTTPS URL.