hookup icon indicating copy to clipboard operation
hookup copied to clipboard

hookup: command not found when checkout.

Open levineran opened this issue 7 years ago • 7 comments

Hi, I've installed as mentioned in the instructions, and I get error whenever I checkout:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree checkout master 
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)
Switched to branch 'master'
.git/hooks/post-checkout: line 2: hookup: command not found
Completed with errors, see above

I use mac.

Any solution?

levineran avatar Jun 22 '18 06:06 levineran

It sounds like you need to run gem install hookup again. If you already have, then you need to examine how you normally access your Ruby gem binaries: Do you use a Ruby version manager like rbenv (which I'd recommend)? If so, then follow the instructions for your Ruby version manager so you can execute the binaries. For rbenv in particular, you'll need this in your ~/.bash_profile:

eval "$(rbenv init -)"

m1foley avatar Jun 22 '18 16:06 m1foley

this is my bash profile file, after the change I made:

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
eval "$(rbenv init -)"

still doesn't work.

levineran avatar Jun 24 '18 14:06 levineran

I was to fix it by editing the post-checkout hook:

#!/bin/bash
PATH=$PATH:/usr/local/bin:/usr/local/sbin:/Users/eranlevin/.rbenv/shims:/Users/eranlevin/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sb
hookup post-checkout "$@"

maybe you can make a patch that will obviate it?

levineran avatar Jun 25 '18 08:06 levineran

That's a passable workaround but something is still off with your rbenv config if you need it.

tpope avatar Jun 25 '18 17:06 tpope

Yeah, all that PATH stuff should be taken care of in your shell settings (~/.bash_profile if you use Bash, the MacOS default). This is a problem with your rbenv config, not with hookup specifically.

For example, I've simplified my .bash_profile to only consist of this:

eval "$(rbenv init -)"

And hookup works in a new terminal:

$ which -a hookup
/Users/mike/.rbenv/shims/hookup

I think it's worth the time figuring this out, because it will likely affect other tools later on. I would set a goal of getting hookup to execute in a new terminal, like I did above.

More ideas:

  • If you use rbenv, try running rbenv versions in your project directory. It could be that your directory specifies a different version of rbenv than the one where you ran gem install hookup.
  • In case something weird happened during the gem install, try gem uninstall hookup and then gem install hookup again.
  • Try temporarily reducing your .bash_profile to my example above, in case something there is mutating your PATH. That really should be all you need.

m1foley avatar Jun 25 '18 18:06 m1foley

it seems that 2 versions are installed:

  system
  2.4.0
* 2.4.3 (set by /Users/eranlevin/.rbenv/version)

but the same version is installed both in global and in the project.

the which returned me: /Users/eranlevin/.rbenv/shims/hookup

levineran avatar Jun 26 '18 11:06 levineran

If you can run hookup from your project directory then it seems like it should work. At this point I don't know how else to help you.

m1foley avatar Jun 26 '18 20:06 m1foley