gxc
gxc

Reputation: 5118

Installing Git HTML Help on OSX

I've tried to install the Git HTML help pages on OSX according to the instructions provided by the following links:

But when I get to the final verification step that involves running:

git help --web commit

I get the following error:

fatal: '/usr/local/git/share/doc/git-doc': not a documentation directory

I've verified that the folder, /usr/local/git/share/doc/git-doc was in fact created when I ran "git clone", and that it is full of files that appear to be git documentation files.

Can someone let me know what I am missing? Thanks!

Here is a short list of some of the files that were created in the git-doc folder:

EDIT: Just looked over the git clone results and found this warning, not sure if it makes a difference: "Remote branch html not found in upstream origin, using HEAD instead"

Upvotes: 10

Views: 1773

Answers (2)

erop
erop

Reputation: 1590

Change clone command address from

$ sudo git clone git://git.kernel.org/pub/scm/git/git.git git-doc --branch html

to

$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc

Hope this will be changed in Github tutorial soon.

UPDATE:

If you are one of those who thinks it’s enough to have Apple Git distribution supplied with Xcode 4:

# create directory to keep Git documentation html-files
$ sudo mkdir -p /usr/local/git/share/doc # or whatever directory you choose

# change to that directory
$ cd /usr/local/git/share/doc

# clone repo with documentation 
$ sudo git clone git://git.kernel.org/pub/scm/git/git-htmldocs.git git-doc 

# point your Git explicitly to a new documentation directory
$ git config --global help.htmlpath /usr/local/git/share/doc/git-doc

# tell Git to use html-formatted help by default
$ git config --global help.format html

This will create an entry in your .gitconfig like:

[help]
    format = html
    htmlpath = /usr/local/git/share/doc/git-doc

Upvotes: 16

VonC
VonC

Reputation: 1324537

The code is (builtin/help.c):

static void get_html_page_path(struct strbuf *page_path, const char *page)
{
  struct stat st;
  const char *html_path = system_path(GIT_HTML_PATH);

  /* Check that we have a git documentation directory. */
  if (stat(mkpath("%s/git.html", html_path), &st)
      || !S_ISREG(st.st_mode))
    die("'%s': not a documentation directory.", html_path);

  strbuf_init(page_path, 0);
  strbuf_addf(page_path, "%s/%s.html", html_path, page);
}

So there might be some issue with GIT_HTML_PATH environment variable (as in that old issue), or you don't have any git.html file in your destination help directory.

Upvotes: 0

Related Questions