Skip to content

Overcommit makes it impossible to use Github for Desktop (Mac) to commit #402

Description

@jakeonrails

Hi there,

My project uses RVM to manage Ruby and I have Overcommit installed on Ruby 2.2.5, the Ruby my project uses.

When I try to commit using Github for Mac, I get this error:

This repository contains hooks installed by Overcommit, but the `overcommit` gem is not installed.
Install it with `gem install overcommit`.
 (1)

From what I understand the issue is that Github for Mac is not loading up the shell environment (.bashrc/.zshrc) so it does not have RVM on the path.

I have read that you can install overcommit onto the system Ruby but that seems like a hack that will only temporarily work, and would require my team to update their system Ruby with dependencies that may or may not match what we use in our project.

I have tried the following workarounds:

  1. Changing the shebang in pre-commit to !#/usr/bin/env rvm 2.2.5 do ruby
  2. Changing the shebang to !#rvm-auto-ruby

I have considered replacing pre-commit with a sh script that loads up the RVM env of the project and then runs a copy of the original ruby script through that environment but I don't have the time and don't want to invest it if that won't work or if there is a more obvious solution.

Does anyone have any ideas about how to make Overcommit compatible with both Github for Mac and RVM? Would it make sense to convert the Ruby hooks into shell scripts that:

  1. Check the project itself for some sort of metadata about what Ruby to use to run the Ruby scripts
  2. Use that Ruby (could be system ruby by default, or RVM Ruby) to then launch the Ruby script

If that is the case, I may be able to hack on this this week in the evenings but don't want to waste my time on something that is a dead end or has a better short-circuit answer.

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions