Git Post-Receive Hook Not Running Bundle Install

bundle install not running from my post-update hook

Your hook shell ins't the same than the one you logged in (and which has the proper PATH)

You can try using at the beginning your your hook script:

#!/bin/bash -l

(See this answer

The -l parameter executes the command in a login shell, which means that it inherits your path and other settings from your shell profile.

)

Or you can make sure your script gets the same environment than your current session, by adding in the first lines of your hook:

$ source $HOME/.bash_profile # single user RVM setup
$ source /etc/profile # multi user RVM setup

Or (final alternative) you can add (before calling bundle) (for a single-user rvm installation)

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Git post-receive hook not using ruby version specified by rbenv

I was struggling same problem some years ago but with cron.

I think your .bashrc needs some details. bundle and rake commands are rbenv shims, but you are not loading them in your path.
.bashrc

export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

and prefix your commands with shims path (I just took code from my crontab)

...
$HOME/.rbenv/shims/bundle install
$HOME/.rbenv/shims/rake db:create
$HOME/.rbenv/shims/rake db:migrate
$HOME/.rbenv/shims/rake assets:precompile
...

Git push error pre-receive hook declined

Seems the problem is with some services, like sidekiq. Running sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production outputs all the problems with config.

Why can't my post-receive hook run a virtualenv source command?

This is something of a guess, since you haven't quoted your complete post-receive hook, but I suspect that you don't have a shebang line pointing to /bin/bash at the top. Your post-receive hook should begin:

#!/bin/bash

I suspect this because if I run a strict Bourne shell, like dash, I get the same error when trying to source anything with source.

Git on Windows post-receive hook to create bundle

As far as I know, no log file is generated. You can modify your script to log what you want though.

Also, make sure your script is executable.

how to automatically run bundle install if the gemfile is updated after a git pull/merge?

You can create a post-merge hook that will fire everytime you pull changes:

~/.git/post-merge

... and set it up to re-install bundle if needed:

bundle check || bundle install

Post-receive hook not using correct Ruby

so:

1) your shebang is /usr/bin/env sh - this is not RVM compatible shell, either use zsh or bash

2) you need to use RVM somehow, when you login via ssh you already used RVM via ~/.bash_profile but in the script you do not load RVM, try this shebang:

/home7/contenw6/.rvm/bin/rvm-shell 1.9.3-p194

Rails why use capistrano when you have git post-receive hook?

Git hooks allow you to execute script related to the git repository on a given action.

Capistrano allows you to administer your production deploys.

A single call to 'cap deploy' will clone your master branch on your target machine, archive the previous release, precompile your assets, restart passenger. Capistrano can also migrate your database, or execute any number of arbitrary commands you want on any server configured in your deploy.rb file.

Go with Capistrano for deploying to app/db server environments, you will have no trouble finding help when you get a problem with a deploy.



Related Topics



Leave a reply



Submit