本文为您详细介绍如何创建 Git 代码仓库。
进入项目
1. 登录 CODING 控制台,单击团队域名进入 CODING 使用页面。
2. 单击团队首页左侧的项目,进入项目列表页,选择目标项目。
3. 选择左侧菜单代码仓库,进入代码仓库首页。
手动创建仓库
1. 登录团队后,单击首页左侧的代码仓库中的创建代码仓库进行创建。
![](https://qcloudimg.tencent-cloud.cn/image/document/8d43ad771d0b012c2344388d15cc95f2.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/8d43ad771d0b012c2344388d15cc95f2.png)
2. 代码仓库无法独立存在,需从属于某个项目。两者的对应关系为一个项目对应多个代码仓库。
![](https://qcloudimg.tencent-cloud.cn/image/document/ccc001e6889387cfa2d67d5dcb13eb08.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/ccc001e6889387cfa2d67d5dcb13eb08.png)
3. 仓库类型选择 Git,输入符合条件的仓库名称。
4. 创建代码仓库时还可以选择是否启用仓库规范,用以快速制订团队开发工作流。
![](https://qcloudimg.tencent-cloud.cn/image/document/72ab30583d83a1eceef5287788a1a9c8.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/72ab30583d83a1eceef5287788a1a9c8.png)
模板创建仓库
CODING 提供数个预置开发框架的代码仓库模块,助您快速体验代码仓库时如何与持续集成或构建产物进行关联。
![](https://qcloudimg.tencent-cloud.cn/image/document/109a4a0a47008bee46b678306a2488aa.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/109a4a0a47008bee46b678306a2488aa.png)
导入外部仓库
初始化 Git 仓库
创建仓库后可以通过四种方式进行初始化。
![](https://qcloudimg.tencent-cloud.cn/image/document/eaaf4024d15ceebfb34fe2ac561b6c43.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/eaaf4024d15ceebfb34fe2ac561b6c43.png)
导入外部仓库
输入 Git 仓库地址后进行导入,完成初始化。
![](https://qcloudimg.tencent-cloud.cn/image/document/e0dcea53eaba257abd56e877ed772c48.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/e0dcea53eaba257abd56e877ed772c48.png)
快速初始化仓库
此方法将通过生成 README.md 文件完成初始化。
![](https://qcloudimg.tencent-cloud.cn/image/document/71f1cf2662c1a2d15e8af2268bb4cb52.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/71f1cf2662c1a2d15e8af2268bb4cb52.png)
使用命令行创建仓库
此方法本质上是在本地仓库中生成一个 README.md 文件后上传至远端仓库完成初始化。
![](https://qcloudimg.tencent-cloud.cn/image/document/05ba088805e7b535299a6df08d018c75.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/05ba088805e7b535299a6df08d018c75.png)
使用命令行推送本地仓库
您也可以直接将本地已初始化的仓库上传至远端仓库中。
![](https://qcloudimg.tencent-cloud.cn/image/document/6f2b9bb7dffda53806557f6e84b34cc1.png)
![](https://qcloudimg.tencent-cloud.cn/image/document/6f2b9bb7dffda53806557f6e84b34cc1.png)