Reputation: 150565
I'm trying to find a way to store and retrieve the description of a bare Git repository.
For normal repositories, I use a README file where I can leave a description of the project. But this does not exist in a bare repository.
I'm using the description
file in the bare repository at the moment. But I wanted to know if there was a git command to read and/or set the contents of this file without having to open/edit the file directly.
Upvotes: 5
Views: 4322
Reputation: 4709
I first convert the URL of the repo. I want to query to https (in case it's a ssh URL) :
alias gitHTTP_URL='\git config remote.origin.url | \sed -E "s|^git@|https://|;s|(\.\w+):|\1/|"'
Then I type this (the pup tool is needed) to fetch the page title with the cURL standard tool :
echo $(\curl -qs $(gitHTTP_URL) | pup --charset utf8 "title text{}" | cut -d: -f2-)
Upvotes: 1
Reputation: 1323165
Note: as an alternative, you can consider git notes
: a note can be put, updated or removed even in a bare repo!
VonC@NETVONC /c/Prog/git/t/gitolite.git (BARE:pu)
$ git notes --ref descr add -m "a description" initcommit
VonC@NETVONC /c/Prog/git/t/gitolite.git (BARE:pu)
$ git notes --ref descr show initcommit
a description
What I like to do is to tag the first commit with a tag nammed "initcommit
", that way I can easily get back a note in a given namespace (here 'descr'), if that note isn't supposed to have information about a "current" commit, but rather information valid for the all repo.
So I attach said note to a "fixed" commit I know I can always refer to (here the first commit, with its dedicated tag).
Upvotes: 2
Reputation: 90276
No, description
file is self-contained, so there's no need to provide git commands to edit/view it. Just use it as a normal file.
Upvotes: 3