How to clone one gitlab project to github

Importing a Git repository using the command line

If 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.

1.Create a new repository on GitHub.

Create a new repository on GitHub.

You’ll import your external Git repository to this new repository.
On the command line, make a “bare” clone of the repository using the external clone URL. This creates a full copy of the data, but without a working directory for editing files, and ensures a clean, fresh export of all the old data.

2.Makes a bare clone of the external repository in a local directory

$ git clone --bare https://old-host.com/old-user/repo.git

3.Pushes the mirror to the new repository on GitHub.com

Push the locally cloned repository to GitHub using the “mirror” option, which ensures that all references, such as branches and tags, are copied to the imported repository.

$ cd repo.git

$ git push --mirror https://github.com/gh-new-user/repo.git

Practice:
PS C:\Users\XXXXX\temp-del-march\junit-test

git clone --bare git@gitlab.com:chenxxxxxXXXX/junit5-test.git

Cloning into bare repository ‘junit5-test.git’…
remote: Enumerating objects: 42, done.
remote: Counting objects: 100% (42/42), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 42 (delta 4), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (42/42), 53.92 KiB | 4.90 MiB/s, done.
Resolving deltas: 100% (4/4), done.
PS C:\Users\XXXXX\temp-del-march\junit-test

ls

Directory: C:\Users\XXXXX\temp-del-march\junit-test

Mode LastWriteTime Length Name


                                              it

PS C:\Users\XXXXX\temp-del-march\junit-test

cd junit5-test.git

PS C:\Users\XXXXX\temp-del-march\junit-test\junit5-test.git

git push --mirror https://github.com/sxxxxchenXXXX/junit-test.git

git: ‘credential-cache’ is not a git command. See ‘git --help’.
git credential-'cache store: -c: line 0: unexpected EOF while looking for matching '' git credential-'cache store: -c: line 1: syntax error: unexpected end of file git credential-'cache store: -c: line 0: unexpected EOF while looking for matching‘’
git credential-‘cache store: -c: line 1: syntax error: unexpected end of file
git credential-‘cache store: -c: line 0: unexpected EOF while looking for matching `’’
git credential-'cache store: -c: line 1: syntax error: unexpected end of file
Enumerating objects: 42, done.
Counting objects: 100% (42/42), done.
Delta compression using up to 8 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (42/42), 53.92 KiB | 13.48 MiB/s, done.
Total 42 (delta 4), reused 42 (delta 4), pack-reused 0
remote: Resolving deltas: 100% (4/4), done.
To https://github.com/sxxxxchenXXXX/junit-test.git

  • [new branch] feature_chenxx03 -> feature_chenxx03
  • [new branch] master -> master
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值