Kit
Kit

Reputation: 31513

How do I install the Git man pages on OS X?

I installed Git via the Mac OS X link here http://git-scm.com/download

After installing it, I try the following in the Terminal:

$ git help fetch
$ git help remote
$ man git
$ man git-fetch

However, I get the message No manual entry for git-<subcommand>. How do I install the man pages for Git? I have the same problem as explained here, but kernel.org is down so it doesn't help much.

Upvotes: 2

Views: 2710

Answers (6)

chillin
chillin

Reputation: 121

Do not set the MANPATH variable in OS X... it will break man!
These instructions will work, will not break anything, and you can automate with a script.

1) have the source file for the man page you want to install (i.e. document formatted with groff). If the source file is plain text, you can use a tool like txt2man to convert it, or you can learn the groff syntax and format it manually. I found a nice treatment on how to create properly formatted man pages here.

2) Name the file after the command that it documents, with a suffix of what section it belongs in. Most man pages are in man1, so if you have the git man source file, name it "git.1" if it isn't already properly named.

3) give the source file the correct permissions:
sudo chown root:admin git.1
sudo chmod 444 git.1

4) gunzip the source file (I use tar):
sudo tar -czf git.1.gz git.1

5) move the gunzipped file to the proper location (using -n argument to prevent writing over an existing man page)
sudo mv -n git.1.gz /usr/share/man/man1/

you're done.

man git

Upvotes: 2

Abizern
Abizern

Reputation: 150605

I use this script (from the top level of my local git source repository) to update my git install, build it, update the documentation branch and install the man pages

git checkout master;  # Makes sure I am on the master branch
git pull; # pull the changes down
make prefix=/usr/local/git all; # configure my local installation directory
sudo make prefix=/usr/local/git install; # Make and install the git binaries
sudo git clean -dxf; # clear out the intermediate files created during compilation
git checkout html; # checkout my local html which tracks origin/html
git pull; # Pull the changes down. I leave the repo with this branch so I can see all the documentation
git archive origin/man | tar xvC /usr/local/share/man; # Install the manpages.

The last line is the one that unpacks and installs the man pages. It creates a zip archive of the man pages in the repository, but rather than writing them out to a file, pipes it to the manages directory.

Upvotes: 0

Kit
Kit

Reputation: 31513

Found it.

$ cd /usr/local/git/share/man
$ sudo git clone http://git.kernel.org/pub/scm/git/git-manpages.git

Then in .bash_profile, add the following line:

export MANPATH="${MANPATH}:/usr/local/git/share/man/git-manpages"

Upvotes: 6

manojlds
manojlds

Reputation: 301117

You want to try:

git fetch --help

Upvotes: 0

mattyohe
mattyohe

Reputation: 1814

Also, instead of:

$ help git fetch

You would want:

$ git help fetch

Upvotes: 1

Carl Norum
Carl Norum

Reputation: 224864

Add /usr/local/git/share/man to your shell's MANPATH environment variable.

Upvotes: 0

Related Questions