Deprecation announcement for non-Git repository imports in GitHub Importer (SVN, Mercurial, TFVC) (#36378)

Co-authored-by: Tim Rogers <timrogers@github.com>
Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com>
This commit is contained in:
Laura Coursen 2023-04-17 08:05:16 -05:00 коммит произвёл GitHub
Родитель aabaaf9e38
Коммит 4be53a1de0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
19 изменённых файлов: 322 добавлений и 172 удалений

Просмотреть файл

@ -68,4 +68,4 @@ SVN is configured to assume that the history of a project never changes. Git all
## Further reading
- ["Branching and Merging" from the _Git SCM_ book](https://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging)
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/source-code-migration-tools)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-subversion-repository)"

Просмотреть файл

@ -19,6 +19,8 @@ During an import, depending on the version control system you're importing from,
## Supported functionality by version control system
{% data reusables.migrations.github-importer-non-git-deprecation %}
{% rowheaders %}
| Import action | Subversion | Mercurial | TFVC | Git |
@ -33,4 +35,3 @@ During an import, depending on the version control system you're importing from,
## Further reading
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-an-external-git-repository-using-the-command-line)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/source-code-migration-tools)"

Просмотреть файл

@ -12,16 +12,19 @@ versions:
ghec: '*'
shortTitle: Import a repository
---
{% tip %}
**Tip:** GitHub Importer is not suitable for all imports. For example, if your existing code is hosted on a private network, our tool won't be able to access it. In these cases, we recommend [importing using the command line](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-an-external-git-repository-using-the-command-line) for Git repositories or an external [source code migration tool](/migrations/importing-source-code/using-the-command-line-to-import-source-code/source-code-migration-tools) for projects imported from other version control systems.
## About repository imports with GitHub Importer
{% endtip %}
GitHub Importer is not suitable for all imports. For example, if your existing code is hosted on a private network, our tool won't be able to access it. In these cases, we recommend [importing using the command line](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-an-external-git-repository-using-the-command-line) for Git repositories or an external [source code migration tool](/migrations/importing-source-code/using-the-command-line-to-import-source-code) for projects imported from other version control systems.
{% data reusables.migrations.github-importer-non-git-deprecation %}
If you'd like to match the commits in your repository to the authors' GitHub personal accounts during the import, make sure every contributor to your repository has a GitHub account before you begin the import.
{% data reusables.repositories.repo-size-limit %}
## Importing a repository with GitHub Importer
1. In the upper-right corner of any page, click {% octicon "plus" aria-label="Create new..." %}, and then click **Import repository**.
![Screenshot of the top-right corner of any page on {% data variables.product.prodname_dotcom %}. A plus icon is highlighted with an orange outline.](/assets/images/help/importer/import-repository.png)

Просмотреть файл

@ -0,0 +1,40 @@
---
title: About source code imports using the command line
intro: 'You can use command line tools to import source code and its revision history to {% data variables.product.product_name %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: About source code imports
---
{% ifversion fpt or ghec %}
If you want to import a Git repository that is stored on a code hosting service that is publicly available on the internet, we recommend using GitHub Importer. For more information, see "[AUTOTITLE](/migrations/importing-source-code/using-github-importer)."
If your source code is not tracked by Git or is not publicly available, you can use the command line instead.
{% else %}
You can use the command line to import source code and, if the code has been tracked using a version control system like Git, the code's revision history.
{% endif %}
- To import a Git repository that is stored on a code hosting service{% ifversion fpt or ghec %} that is not accessible from the public internet{% endif %}, see "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-an-external-git-repository-using-the-command-line)."
- To import code that is only stored locally, and is either tracked by Git or not tracked by any version control system, see "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/adding-locally-hosted-code-to-github)."
- To import code that is tracked by any version control system other than Git, first convert the repository to Git, then push the Git repository to {% data variables.product.product_name %}.
{% ifversion fpt or ghec or ghae %}
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-subversion-repository)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-mercurial-repository)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-team-foundation-version-control-repository)"
{% else %}
- End users can use third-party conversion tools.
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-subversion-repository)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-mercurial-repository)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-team-foundation-version-control-repository)"
- Site administrators can use the administrative shell. For more information, see "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-from-other-version-control-systems-with-the-administrative-shell)."
{% endif %}
All of these tools import source code and revision history, only. If you also want to import your settings and your collaboration history, such as issues and pull requests, you'll need to use more advanced tools. To determine the best tool to use for your migration, see "[AUTOTITLE](/migrations/overview/planning-your-migration-to-github)."

Просмотреть файл

@ -1,6 +1,6 @@
---
title: Adding locally hosted code to GitHub
intro: 'If your code is stored locally on your computer, you can import the code to {% data variables.product.product_name %} using {% data variables.product.prodname_cli %} or Git commands.'
intro: 'If your code is stored locally on your computer and is tracked by Git or not tracked by any version control system (VCS), you can import the code to {% data variables.product.product_name %} using {% data variables.product.prodname_cli %} or Git commands.'
redirect_from:
- /articles/add-an-existing-project-to-github
- /articles/adding-an-existing-project-to-github-using-the-command-line
@ -13,86 +13,92 @@ versions:
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Add local code
shortTitle: Local code
---
## About adding existing source code to {% data variables.product.product_name %}
If you have source code stored locally on your computer, you can add the code to {% data variables.product.product_name %} by typing commands in a terminal. You can do this by typing Git commands directly, or by using {% data variables.product.prodname_cli %}.
If you have source code stored locally on your computer that is tracked by Git or not tracked by any version control system (VCS), you can add the code to {% data variables.product.product_name %} by typing commands in a terminal. You can do this by typing Git commands directly, or by using {% data variables.product.prodname_cli %}.
{% data variables.product.prodname_cli %} is an open source tool for using {% data variables.product.prodname_dotcom %} from your computer's command line. {% data variables.product.prodname_cli %} can simplify the process of adding an existing project to {% data variables.product.product_name %} using the command line. To learn more about {% data variables.product.prodname_cli %}, see "[AUTOTITLE](/github-cli/github-cli/about-github-cli)."
{% tip %}
{% note %}
**Tip:** If you're most comfortable with a point-and-click user interface, try adding your project with {% data variables.product.prodname_desktop %}. For more information, see "[AUTOTITLE](/desktop/contributing-and-collaborating-using-github-desktop/adding-and-cloning-repositories/adding-a-repository-from-your-local-computer-to-github-desktop)" in the *{% data variables.product.prodname_desktop %} Help*.
**Note:** If you're most comfortable with a point-and-click user interface, consider adding your project with {% data variables.product.prodname_desktop %} instead. For more information, see "[AUTOTITLE](/desktop/contributing-and-collaborating-using-github-desktop/adding-and-cloning-repositories/adding-a-repository-from-your-local-computer-to-github-desktop)."
{% endtip %}
{% endnote %}
If your source code is tracked by a different VCS, such as Mercurial, Subversion, or Team Foundation Version Control, you must convert the repository to Git before you can add the project to {% data variables.product.product_name %}.
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-subversion-repository)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-mercurial-repository)"
- "[AUTOTITLE](/migrations/importing-source-code/using-the-command-line-to-import-source-code/importing-a-team-foundation-version-control-repository)"
{% data reusables.repositories.sensitive-info-warning %}
## Adding a local repository to {% data variables.product.product_name %} with {% data variables.product.prodname_cli %}
## Initializing a Git repository
1. In the command line, navigate to the root directory of your project.
1. Initialize the local directory as a Git repository.
If your locally-hosted code isn't tracked by any VCS, the first step is to initialize a Git repository. If your project is already tracked by Git, skip to "[Importing a Git repository with the command line](#importing-a-git-repository-with-the-command-line)."
```shell
git init -b main
```
{% data reusables.command_line.open_the_multi_os_terminal %}
1. Navigate to the root directory of your project.
1. Initialize the local directory as a Git repository. By default, the initial branch is called `main`.
1. Stage and commit all the files in your project.
If youre using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`.
```shell
git add . && git commit -m "initial commit"
git init -b main
```
If youre using Git 2.27.1 or an earlier version, you can set the name of the default branch using `git symbolic-ref`.
``` shell
git init && git symbolic-ref HEAD refs/heads/main
```
1. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
1. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
## Importing a Git repository with the command line
After you've initialized a Git repository, you can push the repository to {% data variables.product.product_name %}, using either {% data variables.product.prodname_cli %} or Git.
- "[Adding a local repository to {% data variables.product.prodname_dotcom %} with {% data variables.product.prodname_cli %}](#adding-a-local-repository-to-github-with-github-cli)"
- "[Adding a local repository to {% data variables.product.prodname_dotcom %} using Git](#adding-a-local-repository-to-github-using-git)"
### Adding a local repository to {% data variables.product.prodname_dotcom %} with {% data variables.product.prodname_cli %}
1. To create a repository for your project on GitHub, use the `gh repo create` subcommand. When prompted, select **Push an existing local repository to GitHub** and enter the desired name for your repository. If you want your project to belong to an organization instead of your user account, specify the organization name and project name with `organization-name/project-name`.
1. Follow the interactive prompts. To add the remote and push the repository, confirm yes when asked to add the remote and push the commits to the current branch.
1. Alternatively, to skip all the prompts, supply the path to the repository with the `--source` flag and pass a visibility flag (`--public`, `--private`, or `--internal`). For example, `gh repo create --source=. --public`. Specify a remote with the `--remote` flag. To push your commits, pass the `--push` flag. For more information about possible arguments, see the [GitHub CLI manual](https://cli.github.com/manual/gh_repo_create).
## Adding a local repository to {% data variables.product.product_name %} using Git
### Adding a local repository to {% data variables.product.prodname_dotcom %} using Git
{% mac %}
1. [Create a new repository](/repositories/creating-and-managing-repositories/creating-a-new-repository) on {% data variables.location.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}.
![Create New Repository drop-down](/assets/images/help/repository/repo-create.png)
{% data reusables.command_line.open_the_multi_os_terminal %}
3. Change the current working directory to your local project.
4. Use the `init` command to initialize the local directory as a Git repository. By default, the initial branch is called `main`.
If youre using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`.
``` shell
$ git init -b main
```
If youre using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git symbolic-ref HEAD refs/heads/main`.
``` shell
$ git init && git symbolic-ref HEAD refs/heads/main
```
5. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
6. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
7. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
{% data reusables.migrations.create-empty-repo %}
1. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
![Copy remote repository URL field](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)
8. In Terminal, [add the URL for the remote repository](/get-started/getting-started-with-git/managing-remote-repositories) where your local repository will be pushed.
{% data reusables.command_line.open_the_multi_os_terminal %}
1. Change the current working directory to your local project.
1. [Add the URL for the remote repository](/get-started/getting-started-with-git/managing-remote-repositories) where your local repository will be pushed.
```shell
$ git remote add origin &lt;REMOTE_URL>
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
```
9. [Push the changes](/get-started/using-git/pushing-commits-to-a-remote-repository) in your local repository to {% data variables.location.product_location %}.
1. [Push the changes](/get-started/using-git/pushing-commits-to-a-remote-repository) in your local repository to {% data variables.location.product_location %}.
```shell
$ git push -u origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin
@ -102,43 +108,19 @@ If you have source code stored locally on your computer, you can add the code to
{% windows %}
1. [Create a new repository](/repositories/creating-and-managing-repositories/creating-a-new-repository) on {% data variables.location.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}.
![Create New Repository drop-down](/assets/images/help/repository/repo-create.png)
{% data reusables.command_line.open_the_multi_os_terminal %}
3. Change the current working directory to your local project.
4. Use the `init` command to initialize the local directory as a Git repository. By default, the initial branch is called `main`.
If youre using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`.
``` shell
$ git init -b main
```
If youre using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git symbolic-ref HEAD refs/heads/main`.
``` shell
$ git init && git symbolic-ref HEAD refs/heads/main
```
5. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
6. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
7. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
{% data reusables.migrations.create-empty-repo %}
1. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
![Copy remote repository URL field](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)
8. In the Command prompt, [add the URL for the remote repository](/get-started/getting-started-with-git/managing-remote-repositories) where your local repository will be pushed.
{% data reusables.command_line.open_the_multi_os_terminal %}
1. Change the current working directory to your local project.
1. In the Command prompt, [add the URL for the remote repository](/get-started/getting-started-with-git/managing-remote-repositories) where your local repository will be pushed.
```shell
$ git remote add origin &lt;REMOTE_URL>
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
```
9. [Push the changes](/get-started/using-git/pushing-commits-to-a-remote-repository) in your local repository to {% data variables.location.product_location %}.
1. [Push the changes](/get-started/using-git/pushing-commits-to-a-remote-repository) in your local repository to {% data variables.location.product_location %}.
```shell
$ git push origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin
@ -148,43 +130,19 @@ If you have source code stored locally on your computer, you can add the code to
{% linux %}
1. [Create a new repository](/repositories/creating-and-managing-repositories/creating-a-new-repository) on {% data variables.location.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}.
![Create New Repository drop-down](/assets/images/help/repository/repo-create.png)
{% data reusables.command_line.open_the_multi_os_terminal %}
3. Change the current working directory to your local project.
4. Use the `init` command to initialize the local directory as a Git repository. By default, the initial branch is called `main`.
If youre using Git 2.28.0 or a later version, you can set the name of the default branch using `-b`.
``` shell
$ git init -b main
```
If youre using Git 2.27.1 or an earlier version, you can set the name of the default branch using `&& git symbolic-ref HEAD refs/heads/main`.
``` shell
$ git init && git symbolic-ref HEAD refs/heads/main
```
5. Add the files in your new local repository. This stages them for the first commit.
```shell
$ git add .
# Adds the files in the local repository and stages them for commit. {% data reusables.git.unstage-codeblock %}
```
6. Commit the files that you've staged in your local repository.
```shell
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. {% data reusables.git.reset-head-to-previous-commit-codeblock %}
```
7. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
{% data reusables.migrations.create-empty-repo %}
1. At the top of your repository on {% ifversion ghae %}{% data variables.product.product_name %}{% else %}{% data variables.location.product_location %}{% endif %}'s Quick Setup page, click {% octicon "clippy" aria-label="The copy to clipboard icon" %} to copy the remote repository URL.
![Copy remote repository URL field](/assets/images/help/repository/copy-remote-repository-url-quick-setup.png)
8. In Terminal, [add the URL for the remote repository](/get-started/getting-started-with-git/managing-remote-repositories) where your local repository will be pushed.
{% data reusables.command_line.open_the_multi_os_terminal %}
1. Change the current working directory to your local project.
1. [Add the URL for the remote repository](/get-started/getting-started-with-git/managing-remote-repositories) where your local repository will be pushed.
```shell
$ git remote add origin &lt;REMOTE_URL>
# Sets the new remote
$ git remote -v
# Verifies the new remote URL
```
9. [Push the changes](/get-started/using-git/pushing-commits-to-a-remote-repository) in your local repository to {% data variables.location.product_location %}.
1. [Push the changes](/get-started/using-git/pushing-commits-to-a-remote-repository) in your local repository to {% data variables.location.product_location %}.
```shell
$ git push origin main
# Pushes the changes in your local repository up to the remote repository you specified as the origin

Просмотреть файл

@ -0,0 +1,60 @@
---
title: Importing a Mercurial repository
intro: 'You can import a repository from Mercurial by converting the repository to Git, then pushing the Git repository to {% data variables.product.product_name %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Mercurial
---
## Prerequisites
To follow these steps, you must use a macOS or Linux system and have the following tools installed:
- [Mercurial](https://www.mercurial-scm.org)
- [Git](https://git-scm.com/downloads)
- {% data variables.large_files.product_name_long %} ({% data variables.large_files.product_name_short %}) (see "[AUTOTITLE](/repositories/working-with-files/managing-large-files/installing-git-large-file-storage)")
- [Python](https://www.python.org), including the `pip` package manager
## Importing a Mercurial repository
{% data reusables.migrations.create-empty-repo %}
1. To confirm that Mercurial is installed on your machine, run `hg --version`.
The output should be similar to `Mercurial Distributed SCM (version 6.4)`.
{% data reusables.migrations.confirm-git-installed %}
{% data reusables.migrations.confirm-git-lfs-installed %}
1. To confirm that `pip` is installed on your machine, run `pip --version`.
The output should be similar to `pip 21.2.4`.
1. To install the `mercurial` Python package, run `pip install mercurial`.
1. Download the latest release of [fast-export](https://github.com/frej/fast-export/releases) to your machine, then extract the archive.
1. Move into the extracted directory, then run `./hg-fast-export.sh --help`.
The output should start with `usage: hg-fast-export.sh`.
1. Clone your Mercurial repository.
For example, to clone the source code of Mercurial itself to the `mercurial-repo` directory, run `hg clone https://www.mercurial-scm.org/repo/hg mercurial-repo`.
1. Create a new directory, move into the new directory, then initialize a fresh Git repository.
For example, if you want to name your new repository `mercurial-git`, run `mkdir mercurial-git && cd mercurial-git && git init`.
{% data reusables.migrations.move-into-git-repo-directory %}
1. To configure your new Git repository to handle the case of filenames in the same way as Mercurial, run `git config core.ignoreCase false`.
1. To get a list of committers in your Mercurial project and store the list in `committers.txt`, run the following script.
```shell{:copy}
hg log --template "{author}\n" | sort | uniq > committers.txt
```
1. Update your `committers.txt` file, mapping the committer name used in the Mercurial repository to the name you want to use in your Git repository, with the following format:
```
“The Octocat <octocato@gmail.com>”=”Octocat <octocat@github.com>
```
1. In your initialized Git repository, run `hg-fast-export.sh`, passing in the path to your Mercurial repository and the path to your `committers.txt` file as arguments.
For example, `../fast-export-221024/hg-fast-export.sh -r ../mercurial-repo -A ../mercurial-repo/committers.txt -M main`.
1. After the import finishes, to check out your newly-created Git repository, run `git checkout HEAD`.
{% data reusables.migrations.add-github-repo-as-remote %}
{% data reusables.migrations.push-to-github %}

Просмотреть файл

@ -0,0 +1,56 @@
---
title: Importing a Subversion repository
intro: 'You can import a repository from Subversion by converting the repository to Git, then pushing the Git repository to {% data variables.product.product_name %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Subversion
---
## Prerequisites
To follow these steps, you must use a macOS or Linux system and have the following tools installed:
- [Subversion](https://subversion.apache.org)
- [Git](https://git-scm.com/downloads), including `git-svn`
- {% data variables.large_files.product_name_long %} ({% data variables.large_files.product_name_short %}) (see "[AUTOTITLE](/repositories/working-with-files/managing-large-files/installing-git-large-file-storage)")
## Importing a Subversion repository
{% data reusables.migrations.create-empty-repo %}
{% data reusables.migrations.confirm-git-installed %}
1. To confirm that `git svn` is available on your machine, run `git svn --version`.
The output should be similar to `git-svn version 2.40.0 (svn 1.14.2)`.
If you can run `git` successfully but encounter an error when running `git svn`, you may need to install `git svn` separately. We recommend using Homebrew or the Ubuntu package registry, which include `git-svn` packages.
{% data reusables.migrations.confirm-git-lfs-installed %}
1. 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`.
1. Move into the directory for your Subversion repository.
1. To get a list of authors in your Subversion project and store the list in `authors.txt`, run the following script:
```shell{:copy}
svn log -q | grep -e '^r' | awk 'BEGIN { FS = "|" } ; { print "$2 = $2\" }' | sort | uniq > authors.txt
```
1. Update your `authors.txt` file, 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>
```
1. 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`, replacing `URL` with the URL of the Subversion repository, `PATH/TO/DESTINATION` with the path to the directory you want to clone the repository into, and `PATH/TO/AUTHORS.TXT` with the path to your `authors.txt` file.
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 svn` to handle your repository. For more information, see [git-svn](https://git-scm.com/docs/git-svn) in the Git documentation.
1. 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 <kbd>Ctrl</kbd>+<kbd>C</kbd>, 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 %}

Просмотреть файл

@ -0,0 +1,62 @@
---
title: Importing a Team Foundation Version Control repository
intro: 'You can import a repository from Team Foundation Version Control (TFVC) by converting the repository to Git, then pushing the Git repository to {% data variables.product.product_name %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Team Foundation Version Control
---
## About imports from Team Foundation Version Control
We recommend using Azure Repos to convert your Team Foundation Version Control (TFVC) repository to Git. However, Azure Repos only migrates up to 180 days of history. If you wish to retain more history, you can use `git-tfs` instead.
## Migrating with Azure Repos (recommended)
{% note %}
**Note:** Azure Repos only migrates up to 180 days of history. The state of your repository before the 180-day threshold will be migrated in a single initial commit. To retain more history, see "[Migrating with `git-tfs`](#migrating-with-git-tfs)."
{% endnote %}
To follow these steps, you must use a macOS or Linux system and have the following tools installed:
- [Git](https://git-scm.com/downloads)
- {% data variables.large_files.product_name_long %} ({% data variables.large_files.product_name_short %}) (see "[AUTOTITLE](/repositories/working-with-files/managing-large-files/installing-git-large-file-storage)")
{% data reusables.migrations.create-empty-repo %}
{% data reusables.migrations.confirm-git-installed %}
{% data reusables.migrations.confirm-git-lfs-installed %}
1. Convert your TFVC repository to Git using Azure Repos. For instructions, see [Import repositories from TFVC to Git](https://learn.microsoft.com/en-us/azure/devops/repos/git/import-from-tfvc?view=azure-devops) in Microsoft Learn.
1. To clone your Azure Repos repository to your local machine, run `git clone --mirror URL`, replacing URL with the clone URL for your Azure DevOps repository.
To identify the clone URL for your Azure DevOps repository, see [Get the clone URL of an Azure Repos Git repo](https://learn.microsoft.com/en-us/azure/devops/repos/git/clone?view=azure-devops&tabs=visual-studio-2022#get-the-clone-url-of-an-azure-repos-git-repo) in Microsoft Learn.
{% data reusables.migrations.add-github-repo-as-remote %}
{% data reusables.migrations.push-to-github %}
## Migrating with `git-tfs`
If you migrate with `git-tfs`, you will retain the full history of your TFVC repository.
To follow these steps, you must use Windows and have the following tools installed:
- [Visual Studio Team Explorer](https://devblogs.microsoft.com/devops/reintroducing-the-team-explorer-standalone-installer/)
- [`git-tfs`](https://github.com/git-tfs/git-tfs), installed using Chocolatey or by downloading the binary release manually
- [Git](https://git-scm.com/downloads)
- {% data variables.large_files.product_name_long %} ({% data variables.large_files.product_name_short %}) (see "[AUTOTITLE](/repositories/working-with-files/managing-large-files/installing-git-large-file-storage)")
{% data reusables.migrations.create-empty-repo %}
{% data reusables.migrations.confirm-git-installed %}
1. To confirm that `git-tfs` is installed on your machine, run `git tfs --version`.
The output should start with something similar to `git-tfs version 0.32.0.0 (TFS client library 16.0.0.0 (MS))`.
If you get an output similar to `Unable to load DLL 'Microsoft.VisualStudio.Setup.Configuration.Native.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)`, make sure that Visual Studio Team Explorer is correctly installed.
{% data reusables.migrations.confirm-git-lfs-installed %}
1. If you haven't already, configure Git with your name and email address by running `git config --global user.name "NAME"` and `git config --global user.email EMAIL`, replacing NAME with your name and EMAIL with your email address.
1. Run `git tfs clone`, passing your TFVC repositorys URL and repository path as arguments. For example, to convert the `example` repository from `https://dev.azure.com/octocat` into a Git repository stored in the `/example` directory, run `git tfs clone --branches=all https://dev.azure.com/octocat $/example`.
{% data reusables.migrations.move-into-git-repo-directory %}
{% data reusables.migrations.add-github-repo-as-remote %}
{% data reusables.migrations.push-to-github %}

Просмотреть файл

@ -12,7 +12,7 @@ versions:
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Import Git repo
shortTitle: External Git repo
---
Before you start, make sure you know:

Просмотреть файл

@ -8,9 +8,18 @@ versions:
ghae: '*'
# topics:
children:
- /about-source-code-imports-using-the-command-line
- /adding-locally-hosted-code-to-github
- /importing-an-external-git-repository-using-the-command-line
- /source-code-migration-tools
- /importing-a-subversion-repository
- /importing-a-mercurial-repository
- /importing-a-team-foundation-version-control-repository
- /importing-from-other-version-control-systems-with-the-administrative-shell
shortTitle: Command line
redirect_from:
- /articles/importing-from-subversion
- /articles/source-code-migration-tools
- /github/importing-your-projects-to-github/source-code-migration-tools
- /github/importing-your-projects-to-github/importing-source-code-to-github/source-code-migration-tools
- /migrations/importing-source-code/using-the-command-line-to-import-source-code/source-code-migration-tools
---

Просмотреть файл

@ -1,58 +0,0 @@
---
title: Source code migration tools
intro: "If your source code uses Subversion, Mercurial, or Team Foundation Version Control{% ifversion fpt or ghec %} and is not accessible from the public internet{% endif %}, you can use external command line tools to import the code."
redirect_from:
- /articles/importing-from-subversion
- /articles/source-code-migration-tools
- /github/importing-your-projects-to-github/source-code-migration-tools
- /github/importing-your-projects-to-github/importing-source-code-to-github/source-code-migration-tools
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Source code migration
---
{% ifversion fpt or ghec %}
We recommend using [GitHub Importer](/migrations/importing-source-code/using-github-importer/about-github-importer) to import projects from Subversion, Mercurial, Team Foundation Version Control (TFVC), or another Git repository. You can also use these external tools to convert your project to Git.
{% endif %}
## Importing from Subversion
In a typical Subversion environment, multiple projects are stored in a single root repository. On GitHub, each of these projects will usually map to a separate Git repository for a personal account or organization. We suggest importing each part of your Subversion repository to a separate GitHub repository if:
* Collaborators need to check out or commit to that part of the project separately from the other parts
* You want different parts to have their own access permissions
We recommend these tools for converting Subversion repositories to Git:
- [`git-svn`](https://git-scm.com/docs/git-svn)
- [svn2git](https://github.com/nirvdrum/svn2git)
## Importing from Mercurial
We recommend [hg-fast-export](https://github.com/frej/fast-export) for converting Mercurial repositories to Git.
## Importing from TFVC
We recommend [git-tfs](https://github.com/git-tfs/git-tfs) for moving changes between TFVC and Git.
For more information about moving from TFVC (a centralized version control system) to Git, see "[Plan your Migration to Git](https://docs.microsoft.com/devops/develop/git/centralized-to-git)" from the Microsoft docs site.
{% tip %}
**Tip:** After you've successfully converted your project to Git, you can [push it to {% data variables.product.prodname_dotcom %}](/get-started/using-git/pushing-commits-to-a-remote-repository).
{% endtip %}
{% ifversion fpt or ghec %}
## Further reading
- "[AUTOTITLE](/migrations/importing-source-code/using-github-importer/about-github-importer)"
- "[AUTOTITLE](/migrations/importing-source-code/using-github-importer/importing-a-repository-with-github-importer)"
- [{% data variables.product.prodname_learning %}]({% data variables.product.prodname_learning_link %})
{% endif %}

Просмотреть файл

@ -13,10 +13,12 @@ autogenerated: rest
## About source imports
{% data reusables.user-settings.imports-api-classic-pat-only %}
{% data reusables.migrations.github-importer-non-git-deprecation %}
{% data variables.migrations.source_imports_intro %} A typical source import would start the import and then (optionally) update the authors and/or update the preference for using Git LFS if large files exist in the import. You can also create a webhook that listens for the [`RepositoryImportEvent`](/webhooks-and-events/webhooks/webhook-events-and-payloads#repository_import) to find out the status of the import.
{% data reusables.user-settings.imports-api-classic-pat-only %}
The following diagram provides a more detailed example:
```

Просмотреть файл

@ -0,0 +1 @@
1. To add your {% data variables.product.prodname_dotcom %} repository as a remote, run `git remote add origin URL`, replacing `URL` with the URL for the {% data variables.product.prodname_dotcom %} repository you created earlier, such as `https://github.com/octocat/example-repository.git`.

Просмотреть файл

@ -0,0 +1,3 @@
1. To confirm that Git is installed on your machine, run `git --version.`
The output should be similar to `git version 2.40.0`.

Просмотреть файл

@ -0,0 +1,3 @@
1. To confirm that {% data variables.large_files.product_name_short %} is installed on your machine, run `git lfs --version`.
The output should be similar to `git-lfs/3.1.4 (GitHub; darwin arm64; go 1.18.1)`.

Просмотреть файл

@ -0,0 +1 @@
1. Create a new repository on {% data variables.location.product_location %}. To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to {% data variables.product.product_name %}. For more information, see "[AUTOTITLE](/repositories/creating-and-managing-repositories/creating-a-new-repository)."

Просмотреть файл

@ -0,0 +1,5 @@
{% warning %}
**Warning:** Support for importing Mercurial, Subversion and Team Foundation Version Control (TFVC) repositories will end on October 17, 2023. For more details, see the [changelog](https://github.blog/changelog/2023-04-17-deprecation-importing-non-git-repositories-with-github-importer/).
{% endwarning %}

Просмотреть файл

@ -0,0 +1 @@
1. Move into the directory for the newly-created Git repository.

Просмотреть файл

@ -0,0 +1,3 @@
1. To push the repository to {% data variables.product.prodname_dotcom %}, run `git push --mirror origin`.
If your repository contains any files that are larger than {% data variables.product.product_name %}'s file size limit, your push may fail. Move the large files to {% data variables.large_files.product_name_short %} by running `git lfs import`, then try again.