Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add/change a repository description for github via the command line

Tags:

github

I learned how to add a repository via the command line with curl and how to add a description for a commit with git commit, but how to add a repository description via the command line?

like image 755
Gerald Schade Avatar asked Sep 24 '17 10:09

Gerald Schade


2 Answers

As noted in this answer, a repo description as seen on the GitHub website is specific to GitHub only.

So .git/description would not work (only gitweb is using it)

Using the GitHub API would, but you need to integrate the verb PATH with your curl command in order to 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
like image 154
VonC Avatar answered Oct 07 '22 23:10

VonC


Make sure your are in your project's root, where you can locate .git directory, you should do the following steps:

Modify the description file:

vi .git/description

Delete the existing text (press I to switch to edit/insert mode ):

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

Replace the default text with your project's description

My Awesome Project

To save the file and close vi editor. press Esc -> X -> Enter

like image 24
Zee Avatar answered Oct 08 '22 00:10

Zee