通过命令行创建Gitee远程仓库
创建Gitee私人令牌:
进入Gitee - 用户 - 设置 - 私人令牌 - 生成新令牌,将得到一个access_token,格式为“xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”
如果没有配置SSH需要先配置SSH
通过命令行创建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"}'
提交到该仓库:
git add .
git commit -m "commit"
git remote add origin https://gitee.com/my-name/my-project.git
git push -u origin master