如何通过命令行为github添加/更改存储库描述

时间:2017-09-24 10:46:28

标签: github

我学会了如何通过命令行使用curl添加存储库以及如何使用git commit添加提交描述,但是如何通过命令行添加存储库描述?

2 个答案:

答案 0 :(得分:5)

this answer所述,GitHub网站上的回购说明仅针对GitHub。

因此.git/description不起作用(仅gitweb is using it

使用GitHub API,但您需要integrate the verb PATH with your curl command才能edit your repo

curl -H "Authorization: token OAUTH-TOKEN" \
     --request PATCH \
     --data '{"name":"repo", "description":"a new description"}' \
     https://api.github.com/repos/:owner/:repo

答案 1 :(得分:1)

确保您位于项目的根目录中,您可以在其中找到.git目录,您应该执行以下步骤:

修改描述文件:

vi .git/description

删除现有文本(按I切换到编辑/插入模式):

Unnamed repository; edit this file 'description' to name the repository.

将默认文本替换为项目描述

My Awesome Project

保存文件并关闭vi编辑器。按Esc -> X -> Enter

相关问题