通过命令行创建Gitee远程仓库

创建Gitee私人令牌:

1.进入Gitee - 用户 - 设置 - 私人令牌 - 生成新令牌,将得到一个access_token,格式为“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”

2.如果没有配置SSH需要先配置SSH

3.Windows系统用需要使用Cygwin64 Terminal执行下面的命令

 

通过命令行创建Gitee远程仓库:

列出授权用户的所有仓库:
curl -X GET --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/user/repos?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&sort=full_name&page=1&per_page=20'

创建公开仓库:
curl -X POST --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/user/repos' -d '{"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name":"my-project","has_issues":"true","has_wiki":"true","can_comment":"true"}'

创建私有仓库:
curl -X POST --header 'Content-Type: application/json;charset=UTF-8' 'https://gitee.com/api/v5/user/repos' -d '{"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","name":"my-project","has_issues":"true","has_wiki":"true","can_comment":"true","private":"true"}'
使用Cygwin64 Terminal进入项目根目录:
cd /cygdrive/d/Projects/my-project
提交到该仓库: git add . git commit -m "commit" git remote add origin https://gitee.com/my-name/my-project.git git push -u origin master

 

posted @ 2021-12-26 15:23  starlog  阅读(587)  评论(0编辑  收藏  举报