Are you sure you want to delete this access key?
title | intro | redirect_from | versions |
---|---|---|---|
Importing a Git repository using the command line | {% if currentVersion == "free-pro-team@latest" %}If [GitHub Importer](/articles/importing-a-repository-with-github-importer) is not suitable for your purposes, such as if your existing code is hosted on a private network, then we recommend importing using the command line.{% else %}Importing Git projects using the command line is suitable when your existing code is hosted on a private network.{% endif %} | [/articles/importing-a-git-repository-using-the-command-line] | [{free-pro-team *} {enterprise-server *} {github-ae *}] |
Before you start, make sure you know:
https://external-host.com/user/repo.git
or git://external-host.com/user/repo.git
(perhaps with a user@
in front of the external-host.com
domain name){% tip %}
For purposes of demonstration, we'll use:
https://external-host.com
{% endtip %}
$ git clone --bare https://external-host.com/<em>extuser</em>/<em>repo.git</em>
# Makes a bare clone of the external repository in a local directory
$ cd <em>repo.git</em>
$ git push --mirror https://{% data variables.command_line.codeblock %}/<em>ghuser</em>/<em>repo.git</em>
# Pushes the mirror to the new {% data variables.product.product_name %} repository
$ cd ..
$ rm -rf <em>repo.git</em>
Press p or to see the previous file or, n or to see the next file
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?
Are you sure you want to delete this access key?