在开始之前,请确保您知道:
- GitHub 用户名
- 外部存储库的克隆 URL,例如 https://external-host.com/user/repo.git或git://external-host.com/user/repo.git(可能external-host.com域名前面是user@)
注意
为便于示范,我们将使用:
- 外部帐户 extuser
- 外部 Git 主机 https://external-host.com
- 名为 ghuser**** 的 GitHub 个人帐户
- GitHub.com 上名为“repo.git”**** 的存储库。
-  在 GitHub 上创建新存储库。 您将在此新仓库中导入外部 Git 仓库。 
-  在命令行上,使用外部克隆 URL 创建外部存储库的“裸”克隆。 这会创建数据的完整副本,但没有编辑文件的工作目录,并确保干净、新鲜地导出所有旧数据。 $ git clone --bare https://external-host.com/EXTUSER/REPO.git # Makes a bare clone of the external repository in a local directory
-  使用“mirror”选项将本地克隆的仓库推送到 GitHub,以确保所有引用(如分支和标记)都复制到导入的仓库。 $ cd REPO.git $ git push --mirror https://github.com/USER/REPO.git # Pushes the mirror to the new repository on GitHub.com
-  删除临时本地仓库。 cd .. rm -rf REPO.git
如果要导入的存储库包含大型文件,可能会遇到警告或错误。 要详细了解大型文件及其管理方法,请参阅“关于 GitHub 上的大文件”。