I have post-receive hook with install command:
pip install -r requirements.txt
After I call git push live master
hook calls pip install
command but on remote server installing started on system python2.7 instead of python3.6.4 which I specified as global in pyenv. I guess .bashrc with pyenv setup is not called in non-interactive sessions...
so... how to specify python interpreter in git post-receive hook?
Ugly solutions:
- modify link
/usr/bin/python
so it points to needed interpreter (and same for pip) - specify full path to pip
/home/user/.pyenv/.../pip install -r ...
Solved by creating separate virtualenv and adding source path/to/virtualenv/activate
to the hook script.
In my case virtualenv created by pyenv had non-executable activate
so also needed to make it executable with chmod +x path/to/activate