首页 > 其他分享 >GitHub项目迁移到GitLab

GitHub项目迁移到GitLab

时间:2024-12-16 13:21:40浏览次数:7  
标签:git remote 48 springmvc GitLab maven GitHub easy 迁移

GitHub项目迁移到GitLab

1.克隆GitHub项目到本地

[root@gitclient ~]# mkdir gitrepos
[root@gitclient ~]# cd gitrepos
[root@gitclient gitrepos]# git init .
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
Initialized empty Git repository in /root/gitrepos/.git/
[root@gitclient gitrepos]# git clone https://github.com/xxx/easy-springmvc-maven.git
Cloning into 'easy-springmvc-maven'...
remote: Enumerating objects: 48, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 48 (delta 0), reused 2 (delta 0), pack-reused 45 (from 1)
Receiving objects: 100% (48/48), 9.16 KiB | 1.53 MiB/s, done.
Resolving deltas: 100% (9/9), done.
[root@gitclient gitrepos]# ls
easy-springmvc-maven


2. 在GitLab上创建同名新项目

3. 本地仓库重设远程仓库

[root@gitclient gitrepos]# cd easy-springmvc-maven/
[root@gitclient easy-springmvc-maven]# git remote -v
origin  https://github.com/xxx/easy-springmvc-maven.git (fetch)
origin  https://github.com/xxx/easy-springmvc-maven.git (push)
[root@gitclient easy-springmvc-maven]# git remote set-url origin git@192.168.100.31:plat-group/easy-springmvc-maven.git
[root@gitclient easy-springmvc-maven]# git remote -v
origin  git@192.168.100.31:plat-group/easy-springmvc-maven.git (fetch)
origin  git@192.168.100.31:plat-group/easy-springmvc-maven.git (push)
[root@gitclient easy-springmvc-maven]#


4. push代码到GitLab

[root@gitclient easy-springmvc-maven]# git push origin main:main
Enumerating objects: 48, done.
Counting objects: 100% (48/48), done.
Compressing objects: 100% (32/32), done.
Writing objects: 100% (48/48), 9.16 KiB | 9.16 MiB/s, done.
Total 48 (delta 9), reused 48 (delta 9), pack-reused 0
To 192.168.100.31:plat-group/easy-springmvc-maven.git
 * [new branch]      main -> main
[root@gitclient easy-springmvc-maven]#

:冒号前为本地分支,冒号后为远程分支,远程分支没有则创建。

5. 其他

5.1 报错解决

  • 报错

    To 192.168.100.31:plat-group/easy-springmvc-maven.git
    ! [remote rejected] main -> main (pre-receive hook declined)
    error: failed to push

    
    [root@gitclient easy-springmvc-maven]# git push origin main:main
    Enumerating objects: 48, done.
    Counting objects: 100% (48/48), done.
    Compressing objects: 100% (32/32), done.
    Writing objects: 100% (48/48), 9.16 KiB | 9.16 MiB/s, done.
    Total 48 (delta 9), reused 48 (delta 9), pack-reused 0
    remote: GitLab:
    remote: A default branch (e.g. main) does not yet exist for plat-group/easy-springmvc-maven
    remote: Ask a project Owner or Maintainer to create a default branch:
    remote:
    remote:   http://192.168.100.31/plat-group/easy-springmvc-maven/-/project_members
    remote:
    To 192.168.100.31:plat-group/easy-springmvc-maven.git
     ! [remote rejected] main -> main (pre-receive hook declined)
    error: failed to push some refs to '192.168.100.31:plat-group/easy-springmvc-maven.git'
    
    
  • 原因:

    权限不够

  • 解决办法

    把GitLab用户设置为administrator,

标签:git,remote,48,springmvc,GitLab,maven,GitHub,easy,迁移
From: https://www.cnblogs.com/shiqiang-lee/p/18609873

相关文章

  • Jenkins拉取GitLab代码
    Jenkins从GitLab中拉取代码1.在Jenkins主机上生成ssh密钥[root@jenkinsgitrepo]#ssh-keygen-ted25519Generatingpublic/privateed25519keypair.Enterfileinwhichtosavethekey(/root/.ssh/id_ed25519):Enterpassphrase(emptyfornopassphrase):Entersam......
  • APIsix 实操秘籍:部署迁移实战篇(下)
    接上篇:《APIsix实操秘籍:基础概念入门篇(上)》链接:link文章目录2、核心概念2.2、关键术语2.3、APIsix配置文件3、开启APIsix之旅3.1、APISIX网关高可用部署架构图3.2、裸金属部署3.3、Docker部署3.4、Helm部署apisix3.5、升级迁移指南3.6、常规插件2、核心概念2......
  • .NET8升级.NET9,CodeFirst模式迁移Add-Migration执行Update-DataBase报错
    在做netcore开发时,如果net8一直是正常的,只升级了一下框架net9,在使用EntityFrameworkCore的CodeFirst模式进行迁移时,执行Add-Migration后尝试使用Update-DataBase时出现了如下错误。Unhandledexception.System.InvalidOperationException:Anerrorwasgeneratedforwarni......
  • 如何实现数据库的不停服迁移?
    数据库的“不停服迁移”指的是在不中断数据库服务的情况下,将数据库的数据从一个实例迁移到另一个实例,保证系统持续对外提供服务。这种迁移通常涉及数据的平滑过渡、最小化系统停机时间以及确保数据的一致性。实现不停服迁移的过程复杂,通常需要考虑以下几个方面:实现不停服迁移的关......
  • linux下github全局加速——fastgithub
    安装fastgithub国内大部分服务器无法访问github,或者即时能访问也是速度慢,时灵时不灵的。需要给github加速一下。一般有四种方法:修改/etc/hosts文件,需要实时更新本地下载文件之后再上传到服务器。需要二道程序通过镜像来加速。3.1通过gitee加速,通过修改github地址来将......
  • PbootCMS网站迁移后无法打开,报错“No input file specified”,如何解决?
    当PbootCMS网站迁移后遇到“Noinputfilespecified”的错误提示时,通常是由于服务器配置或文件权限的问题导致的。以下是详细的解决步骤和注意事项:检查.user.ini文件:进入网站的根目录,查找是否存在.user.ini文件。如果存在.user.ini文件,尝试删除它。这个文件有时会干扰服务......
  • AnyBimanual:将单手策略迁移至普通的双手操作
    24年12月来自清华和南洋理工的论文“AnyBimanual:TransferringUnimanualPolicyforGeneralBimanualManipulation”。执行普通语言条件下的双手操作任务,对于从家政服务到工业装配等许多应用都非常重要。然而,由于动作空间高维,收集双手操作数据的成本很高,这对处理一般双......
  • gitlab-runner执行失败
    gitlabrunner:ERROR:Jobfailed:prepareenvironmenthttps://segmentfault.com/a/1190000044719792查询相关的站点显示错误的原因是由于gitlabrunner执行了用户文件夹下的.bash_logout脚本。一般的解决方法都是将github-runner用户下的.bash_logout中的内容注释掉即可。......
  • gitlab-cid示例1
    default:before_script:-echo"startdeploy"-echo$CI_COMMIT_REF_NAME#阶段stages:-install-buildDev-buildTest-buildProd-deployDev-deployTest-deployProdcache:paths:-node_modules/#安装依赖install:stage:instal......
  • GitLab安装使用
    GitLab的安装1.环境配置关闭防火墙和selinux[root@gitlab~]#systemctlstopfirewalld[root@gitlab~]#systemctldisablefirewalldRemoved"/etc/systemd/system/multi-user.target.wants/firewalld.service".Removed"/etc/systemd/system/dbus-org.fedoraproj......