2

In GitHub every repository can have a short description, which is shown under the Code | Network | Pull Requests | Issues | Wiki | Graphs | Settings bar.

I can edit the description on the GitHub webpage, but I want to read and change it with JGit or Git. Is this possible?

(First I tried to read .git/description, but every repository from GitHub just seems o contain the same text:

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

Is .git/description used anywhere?)

Community
  • 1
  • 1
Sonson123
  • 10,879
  • 12
  • 54
  • 72

1 Answers1

2

The .git/description has nothing to do with the description field of a GitHub repo.

You can get that field with a simple curl (i.e. nothing to do with git either), following the GitHub API for repositories:

curl https://api.github.com/repos/:owner/:reponame  2>/dev/null | grep description

# For instance
curl https://api.github.com/repos/VonC/compileEverything  2>/dev/null | grep description

You can edit it easily enough, with a PATCH http method:

curl -u "$user:$pass" -X PATCH -d '{"name":"$reponame","description":"new_value"}' https://api.github.com/repos/$user/$reponame

(same as in "How do I rename a GitHub repository via their API?")

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks, the GitHub API would be possible to get/edit the description. So the description didn't exist somewhere in the Git repository itself (which I hoped first)? – Sonson123 Mar 06 '13 at 07:58
  • 1
    @Sonson123 I have added an edit example. But the description isn't part of the git repo. – VonC Mar 06 '13 at 08:31