轻松搞定 GitHub 搬到 码云
码云Gitee.com上线4年多,已经托管了200万+的项目,累积注册用户150万+啦。
最近,有许多小伙伴问,“我要怎么把 GitHub 上的项目搬到码云上来呀?”
知道你们爱 码云 的快速和友好,来来来,搬家教程送你,放码过来吧。
Ps:文末有彩蛋。
项目名要求:
只允许字母、数字或者下划线(_)、中划线(-)、英文句号(.),必须以字母开头。 不符合项目名要求会导致无法导入。
1. 如何将 GitHub 上的公有项目快速搬到码云上
首先,登录码云账号,然后在顶部导航栏中点击 “+” ,在出现的下拉菜单中选择 “Github导入”。

这会跳转到 GitHub 的登录、授权页面,需要您的授权:

当然,如果您已经登录或授权过了,那么就会直接进入仓库列表页面:

然后点击你需要“导入”的仓库,然后耐心等待几秒钟,项目导入完成。
2. 如何将GitHub上的私有有项目搬到码云上
首先,打开 GitHub 网页,找到要迁移的代码仓库地址,如下:

点击 Clone or Download,出现以下界面:

点击Copy toclipboard(复制到粘贴板)
打开https://desktop.github.com/,下载 GitHub 工具 GitHub Desktop,安装;

在桌面点击 GitHub Desktop 图标:

之后点击中间的图标 Clone a Repository,如图:

将之前粘贴板的内容复制到 URL 处,并选择本地的一个存放位置,点击 Clone。

可在所选本地文件夹处发现克隆到本地的代码仓库:

前期准备,需要在自己的码云账户上添加公钥,具体请见:公钥认证管理

然后,打开 Git Bash(本文将以 Git Bash 为工具进行指导,利用它推送本地仓库代码到远程码云代码仓库)进行验证是否添加成功:

用 Git Bash 寻找到下载到本地的代码仓库,使用 cd 命令:

用命令删除之前关联的 GitHub 远程仓库 git remote rm origin,并重新关联码云仓库地址 git remote add origin仓库地址:

然后使用命令 git push –u origin 分支名 推送分支代码。

最后,在码云界面上验证上传结果。

彩蛋时间
搬家完毕,好奇宝宝们肯定会想,从 GitHub 中转过来的项目,一般 Readme 都是英文。
如果,在国内访问我的项目显示中文介绍,在美国访问我的项目显示英文介绍就好了啊!就可以让全世界都很方便地知道我的项目很不错……
听说你还不知道,码云支持多语言的 Readme 渲染?
悄悄告诉你规则:Readme.md (英文) Readme_ZH.md(中文)。系统会根据用户浏览器的语言来选择对应的版本来渲染哦。
想要了解更多?请举起大拇指,用力戳下面的链接 :)
DuangDuangDuang!码云项目的 Readme.md 特殊技能
Copyright@OSChina.NET
责任编辑:C君
制版编辑:Zico丨
本页刊发内容未经书面许可禁止转载及使用
公众号、报刊等转载请联系授权
欢迎转发朋友圈,投稿:chenyang@oschina.cn
关注码云OSC官方微信公众号:码云Gitee
查看更多有趣的开源项目资讯,请前往:码云开源项目广场