Using the git-import suite of tools, you can import from Subversion, Mercurial and Team Foundation Version Control to Git repositories on GitHub Enterprise.
In this guide
- Importing projects from Mercurial
- Importing projects from Subversion
- Importing projects from Team Foundation Version Control
- Further reading
Importing projects from Mercurial
-
SSH into your GitHub Enterprise instance:
ssh -p 122 admin@hostname
-
Make a raw clone of the project using the command below, specifying the URL of the source project, and a path to a temporary repository:
$ git-import-hg-raw HG-CLONE-URL /PATH/REPO-NAME.git # Creates a new repository with one or more Git refs in `refs/import/` in the specified path.
-
Review the comma-separated (CSV) file in
/PATH/REPO-NAME.git/git-import/raw-authors.csv
. It should contain these columns:-
ID
: The author as stored in the original repository, followed by a unique identifier -
NAME
: The author as stored in the original repository
To map authors from the original repository to an email address and name, create a new CSV file with the columns
ID,(ignored),GIT_EMAIL,GIT_NAME
, which replaces the author information for anything by "ID" with "GIT_EMAIL" and "GIT_NAME".- Original author ID:
octocat@111111-2222-3333-4444-55555555555
- New email address:
octocat@github.com
- New name:
The Octocat
To map the original author to the new Git user, the CSV file should include the line:
octocat@111111-2222-3333-4444-55555555555, ,octocat@github.com,The Octocat
-
-
Rewrite the authors and branches using the CSV file:
$ `git-import-rewrite --flavor hg --authors /PATH/AUTHORS-MAP-FILE.csv /PATH/REPO-NAME.git`
If you haven't yet, create a new empty repository on GitHub Enterprise.
Change the current working directory to your local repository.
-
Push the imported repository to GitHub Enterprise:
$ git push --mirror PUSH-URL-ON-GITHUB-ENTERPRISE
Importing projects from Subversion
-
SSH into your GitHub Enterprise instance:
ssh -p 122 admin@hostname
-
Make a raw clone of the project using the command below, specifying the URL of the source project, and a path to a temporary repository:
$ git-import-svn-raw SVN-CLONE-URL /PATH/REPO-NAME.git # Creates a new repository with one or more Git refs in `refs/import/` in the specified path.
-
Review the comma-separated (CSV) file in
/PATH/REPO-NAME.git/git-import/raw-authors.csv
. It should contain these columns:-
ID
: The author as stored in the original repository, followed by a unique identifier -
NAME
: The author as stored in the original repository
To map authors from the original repository to an email address and name, create a new CSV file with the columns
ID,(ignored),GIT_EMAIL,GIT_NAME
, which replaces the author information for anything by "ID" with "GIT_EMAIL" and "GIT_NAME".- Original author ID:
octocat@111111-2222-3333-4444-55555555555
- New email address:
octocat@github.com
- New name:
The Octocat
To map the original author to the new Git user, the CSV file should include the line:
octocat@111111-2222-3333-4444-55555555555, ,octocat@github.com,The Octocat
-
-
Rewrite the authors and branches using the CSV file:
$ git-import-rewrite --flavor svn --authors /PATH/AUTHORS-MAP-FILE.csv /PATH/REPO-NAME.git`
If you haven't yet, create a new empty repository on GitHub Enterprise.
Change the current working directory to your local repository.
-
Push the imported repository to GitHub Enterprise:
$ git push --mirror PUSH-URL-ON-GITHUB-ENTERPRISE
Importing projects from Team Foundation Version Control
-
SSH into your GitHub Enterprise instance:
ssh -p 122 admin@hostname
-
Make a raw clone of the project using the command below, specifying the URL of the source project, and a path to a temporary repository:
$ git-import-tfs-raw TEAM-FOUNDATION-CLONE-URL /PATH/REPO-NAME.git # Creates a new repository with one or more Git refs in `refs/import/` in the specified path.
-
Review the comma-separated (CSV) file in
/PATH/REPO-NAME.git/git-import/raw-authors.csv
. It should contain these columns:-
ID
: The author as stored in the original repository, followed by a unique identifier -
NAME
: The author as stored in the original repository
To map authors from the original repository to an email address and name, create a new CSV file with the columns
ID,(ignored),GIT_EMAIL,GIT_NAME
, which replaces the author information for anything by "ID" with "GIT_EMAIL" and "GIT_NAME".- Original author ID:
octocat@111111-2222-3333-4444-55555555555
- New email address:
octocat@github.com
- New name:
The Octocat
To map the original author to the new Git user, the CSV file should include the line:
octocat@111111-2222-3333-4444-55555555555, ,octocat@github.com,The Octocat
-
-
Rewrite the authors and branches using the CSV file:
$ git-import-rewrite --flavor tfs --authors /PATH/AUTHORS-MAP-FILE.csv /PATH/REPO-NAME.git`
If you haven't yet, create a new empty repository on GitHub Enterprise.
Change the current working directory to your local repository.
-
Push the imported repository to GitHub Enterprise:
git push --mirror PUSH-URL-ON-GITHUB-ENTERPRISE