3.6 KiB
title, intro, versions, shortTitle
| title | intro | versions | shortTitle | ||||||
|---|---|---|---|---|---|---|---|---|---|
| Importing a Subversion repository | You can import a repository from Subversion by converting the repository to Git, then pushing the Git repository to {% data variables.product.github %}. |
|
Subversion |
Prerequisites
To follow these steps, you must use a macOS or Linux system and have the following tools installed:
- Subversion
- Git, including
git-svn - {% data variables.large_files.product_name_long %} ({% data variables.large_files.product_name_short %}) (see AUTOTITLE)
Importing a Subversion repository
{% data reusables.migrations.create-empty-repo %} {% data reusables.migrations.confirm-git-installed %}
-
To confirm that
git svnis available on your machine, rungit svn --version.The output should be similar to
git-svn version 2.40.0 (svn 1.14.2).If you can run
gitsuccessfully but encounter an error when runninggit svn, you may need to installgit svnseparately. We recommend using Homebrew or the Ubuntu package registry, which includegit-svnpackages. {% data reusables.migrations.confirm-git-lfs-installed %} -
Check out your Subversion repository.
For example, to check out the Logisim open source project from Sourceforge, run
svn checkout https://svn.code.sf.net/p/circuit/code/trunk. -
Move into the directory for your Subversion repository.
-
To get a list of authors in your Subversion project and store the list in
authors.txt, run the following script:svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print $2" = "$2 }' | sed -E 's/^ *//' | sort | uniq > authors.txt -
Update your
authors.txtfile, mapping the author name used in the Subversion repository to the name you want to use in your Git repository, with the following format:octocat = The Octocat <octocat@github.com> -
To convert your Subversion repository to a Git repository, use
git svn.-
If your Subversion repository has a standard format, with “trunk”, “branches”, and “tags” folders, run
git svn clone -s URL PATH/TO/DESTINATION --authors-file PATH/TO/AUTHORS.TXT, replacingURLwith the URL of the Subversion repository,PATH/TO/DESTINATIONwith the path to the directory you want to clone the repository into, andPATH/TO/AUTHORS.TXTwith the path to yourauthors.txtfile.For example, to clone the Logisim project from Sourceforge into a directory called logisim, run
git svn clone -s https://svn.code.sf.net/p/circuit/code logisim --authors-file path/to/authors.txt. -
If your Subversion repository is non-standard, you can customize
git svnto handle your repository. For more information, see git-svn in the Git documentation.
-
-
Git will check out each SVN revision and turn the revision into a Git commit. If your repository has many files or a lot of history, this process will take a long time.
For large repositories, the command may freeze. If so, you can begin where you ended by terminating the command with Ctrl+C, moving to your new directory, and then running
git svn fetch. {% data reusables.migrations.move-into-git-repo-directory %} {% data reusables.migrations.add-github-repo-as-remote %} {% data reusables.migrations.push-to-github %}
{% ifversion fpt or ghec %}
Further reading
- AUTOTITLE {% endif %}