Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jan Grewe
svn2git
Commits
c6e8ec7d
Commit
c6e8ec7d
authored
Oct 17, 2013
by
Jan Grewe
Browse files
initial commit
parents
Changes
2
Hide whitespace changes
Inline
Side-by-side
README
0 → 100644
View file @
c6e8ec7d
Edit sv2ngit.sh to reflect your environment, then create a Git repository
that matches the SVN repositories' name and run:
./svn2git.sh <repository name>
svn2git.sh
0 → 100755
View file @
c6e8ec7d
#!/bin/bash
if
[
-z
${
1
}
]
;
then
echo
"Usage:
$0
<repository name>"
exit
1
fi
REPO
=
"
$1
"
# your SVN repo
SVN
=
"svn://svn.example.com"
# your GitLab installation
GITLAB
=
"https://git.example.com"
# your GitLab username
NAMESPACE
=
"johndoe"
# your "SVN username = Full GitLab name <email@address>"
AUTHOR
=
"jdoe = John Doe <john@example.com>"
echo
${
AUTHOR
}
>
/tmp/svn2git-author.txt
git svn clone
${
SVN
}
/
${
REPO
}
--no-metadata
-A
/tmp/svn2git-author.txt /tmp/git/
${
REPO
}
cd
/tmp/git/
${
REPO
}
git svn show-ignore
--id
git-svn
>
.gitignore
git add .gitignore
git commit
-m
'Convert svn:ignore properties to .gitignore.'
git init
--bare
/tmp/git/
${
REPO
}
.git
cd
../
${
REPO
}
.git
git symbolic-ref HEAD refs/heads/git-svn
cd
../
${
REPO
}
git remote add bare /tmp/git/
${
REPO
}
.git
git config remote.bare.push
'refs/remotes/*:refs/heads/*'
git push bare
git push bare master:git-svn
cd
../
${
REPO
}
.git
git branch
-m
git-svn master
git
for
-each-ref
--format
=
'%(refname)'
refs/heads/tags |
cut
-d
/
-f
4 |
while
read
ref
;
do
git tag
"
$ref
"
"refs/heads/tags/
$ref
"
;
git branch
-D
"tags/
$ref
"
;
done
# automatic project creation disabled, they don't show up in the Web UI?
#sudo -u git /srv/git/gitlab-shell/bin/gitlab-projects add-project ${NAMESPACE}/${REPO}.git
git push
--mirror
${
GITLAB
}
/
${
NAMESPACE
}
/
${
REPO
}
.git
rm
-r
/tmp/git/
${
REPO
}
rm
-r
/tmp/git/
${
REPO
}
.git
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment