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?
Asked
Active
Viewed 3,429 times
9
-
Do you mean using `git`? I don’t think you can, that’s a GitHub-specific thing. If you mean using GitHub’s API, check https://developer.github.com/v3/. – jonrsharpe Sep 24 '17 at 10:53
2 Answers
10
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
VonC
- 1,129,465
- 480
- 4,036
- 4,755
-
when directy applying Your proposal, I got the error "Validation failed",..."field":"name" "message":"name is too short (minimum is 1 character)" ..., so by modifying Your --data -parameter to: '{"name":"repo", "description":"a new description"}', it worked! – Gerald Schade Nov 05 '18 at 23:35
-
-
What does `:owner/:repo` mean? Is it a placeholder to be changed by e.g. vonc/repo1 ? – Timo Apr 05 '22 at 21:19
-
1@Timo A placeholder indeed. You need to replace `:owner` with a GitHub user account, and `:repo` with one of their repositories. – VonC Apr 05 '22 at 22:02
2
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
Zee
- 1,836
- 21
- 41
-
as VonC wrote, this really did not work (for me), even after "git add -u", "git commit" and "git push". – Gerald Schade Nov 05 '18 at 23:45