Go to English page

ViaThinkSoft CodeLib

Dieser Artikel befindet sich in der Kategorie:
CodeLibHowTosSonstiges

This is an Example with GitHub user "danielmarschall" and Repository "oidplus".
Adjust the things to your environment!

1. INITIAL SETUP

# Install GitSVN
aptitude install git-svn

# Only do this if you want that GitHub credentials are saved to disk
# see details here https://stackoverflow.com/questions/35942754/how-to-save-username-and-password-in-git-gitextension
git config --global credential.helper store

# Create authors.txt for all your SVN users (mapping SVN users to GitHub accounts)
echo "daniel-marschall = Daniel Marschall <........email here.........>" > authors.txt
echo "victor = Victor-Philipp Negoescu <..........email here..........>" >> authors.txt
echo "www-data = ViaThinkSoft <.........email here...........>" >> authors.txt

2. FIRST SYNC FROM SVN TO GITHUB

# First, create a repository in GitHub using the web interface:
# https://github.com/new

# Download SVN into a new GIT repo
# "-s" assumes that default trunk/tags/branches structure is used
git svn --authors-file=authors.txt clone -s https://svn.viathinksoft.com/svn/oidplus/ oidplus-gitsvn cd oidplus-gitsvn

cd oidplus-gitsvn/

# Pushes the mirror to the new GitHub repository
git push --mirror https://github.com/danielmarschall/oidplus.git

3. REGULAR UPDATE

cd oidplus-gitsvn/
git svn rebase git push origin --all git push origin

# Pushes the mirror to the new GitHub repository
git push --mirror https://github.com/danielmarschall/oidplus.git

Empty folders

Attention: Empty folders will not be transferred to GIT! You need to make sure that there is a file like ".gitkeep" so that the folders are not empty.
Unfortunately, there is a bug since 2013 that prevents using --keep-empty-dirs if trunk/branch/tag structure was added afterwards, see:
https://www.mail-archive.com/git@vger.kernel.org/msg24484.html
Daniel Marschall
ViaThinkSoft Mitbegründer