0 votes
1 view
in DevOps and Agile by (20k points)

I read the Git manual, FAQ, Git-SVN crash course, etc. and they all explain this and that, but nowhere can I find a simple instruction like:

SVN repository in: svn://myserver/path/to/svn/repos

Git repository in: git://myserver/path/to/git/repos

git-do-the-magic-svn-import-with-history \

svn://myserver/path/to/svn/repos \


I don't expect it to be that simple, and I don't expect it to be a single command. But I do expect it not to try to explain anything - just to say what steps to take given this example.

1 Answer

0 votes
by (119k points)
edited by

I used the following script to read a text file that has a list of all my SVN repositories and convert them to Git, and later use git clone --bare to convert to a bare Git repository:



while IFS= read -r repo_name


 printf '%s\n' "$repo_name"

 sudo git svn clone --shared --preserve-empty-dirs --authors-file=users.txt file:///programs/svn/$repo_name

 sudo git clone --bare /programs/git/$repo_name $repo_name.git

 sudo chown -R www-data:www-data $repo_name.git

 sudo rm -rf $repo_name

done <"$file"

list.txt has the format:



And users.txt has the format:

(no author) = Prince Rogers <[email protected]>

www-data is the Apache webserver user. It needs permission to push changes over HTTP.

Also, check out this Git Tutorial to know more.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !