Commit comments not appearing in Gitlab on CentOS

Last modified: [last-modified]

If you followed my earlier documentation, or simply installed Gitlab yourself on CentOS 6 you might run into this problem:

When you go to the ‘Files’ view of one of your repositories it won’t load any of the commit comments. It just appears to perpetually load.

If you look in your ‘production.log’ you’ll see an error like this:

Processing by RefsController#logs_tree as JS
  Parameters: {"_"=>"1369162443960", "project_id"=>"USERNAME/geoip-lookup", "id"=>"master"}
  Rendered refs/logs_tree.js.haml (57.2ms)
Completed 500 Internal Server Error in 98ms

ActionView::Template::Error (undefined method `committed_date' for nil:NilClass):
    4:
    5:   :plain
    6:     var row = $("table.table_#{@hex_path} tr.file_#{hexdigest(file_name)}");
    7:     row.find("td.tree_time_ago").html('#{escape_javascript time_ago_in_words(commit.committed_date)} ago');
    8:     row.find("td.tree_commit").html('#{escape_javascript render("tree/tree_commit_column", commit: commit)}');
  app/views/refs/logs_tree.js.haml:7:in `block in _app_views_refs_logs_tree_js_haml__4074553552003765415_53128340'
  app/views/refs/logs_tree.js.haml:1:in `each'
  app/views/refs/logs_tree.js.haml:1:in `_app_views_refs_logs_tree_js_haml__4074553552003765415_53128340'

It looks like this is a bug with git itself and not Gitlab.

There is a patch you can manually apply to your Gitlab deployment OR you could just upgrade git to the latest and greatest version. I chose to upgrade git. The below guide assumes you followed my original “How to install Gitlab 5.0 on CentOS 6 or RHEL6” guide. I’ve updated that guide to reflect these new steps.

1. Get logged in to your server and become ‘sa_gitlab’

[[email protected] ~] su - sa_gitlab
[[email protected]~]

 

2. Create a temp directory if you don’t have one and move into it

[[email protected]~] mkdir temp
[[email protected]~] cd temp

 

3. Download the latest source for git from https://code.google.com/p/git-core/downloads/list. As of this writing 1.8.2.3 is the latest version

[[email protected]~] wget -c https://git-core.googlecode.com/files/git-1.8.2.3.tar.gz
[[email protected]~] tar -xf git-1.8.2.3.tar.gz
[[email protected]~] cd git-1.8.2.3

 

4. Configure, compile and install git 1.8.2.3

[[email protected]~] ./configure --prefix=/data/apps/sa_gitlab/git
[[email protected]~] make
[[email protected]~] make install

 

5. Configure your environment so the new version of git overrides the default CentOS version

[[email protected]~] vim ~/.bashrc

# -------- Make the following edits --------

# Change the PATH line to look like this:
PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;

# -------- Save and close the file --------

[[email protected]~] vim ~/.bash_profile

# -------- Make the following edits --------

# Change the PATH line to look like this:
PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;

# -------- Save and close the file --------

 

6. Re-export your path and verify which git is being used and it’s version

[[email protected]~] PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;

[[email protected]~] which git
~/git/bin/git

[[email protected] ~] git --version
git version 1.8.2.3

 

7. Update your gitlab.yml configuration file

[[email protected] ~] cd gitlab
[[email protected] gitlab] vim config/gitlab.yml

# -------- Make the following edits --------

  git:
    bin_path: /data/apps/sa_gitlab/git/bin/git

# -------- Save and close the file --------

 

8. Restart Gitlab

[[email protected] gitlab] exit

[[email protected] ~] service gitlab stop

# Wait 1-2 minutes for everything to exit

[[email protected] ~] service gitlab start

 

That’s it!

Update May 22nd, 2013 – Added step 7. Didn’t realise you had to edit the gitlab.yml file to point to the new git binary location. I assumed Gitlab used the git binary it found via PATH.

3 thoughts on “Commit comments not appearing in Gitlab on CentOS

  1. Thank you Eric. Your guides are really helpful and saves time. few months back, I did not bother to have Gitlab setup just because We are using Centos as our main server and do not have any debians. for Centos there was no 100% sure shot guide available that could help and save time, until I landed on your blogs.

    Thank you again Eric,

    Chetan.

  2. Regarding updating git, I just added the IUS repository ( http://iuscommunity.org/ ) and then did sudo yum remove git; sudo yum install git18;  Didn’t have to make any path changes and I can update git18 with yum.  I think this is probably an easier and more maintainable solution.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.