Skip to content

Instantly share code, notes, and snippets.

@hunterloftis
Created July 12, 2012 19:11
Show Gist options
  • Save hunterloftis/3100224 to your computer and use it in GitHub Desktop.
Save hunterloftis/3100224 to your computer and use it in GitHub Desktop.
"npm install" fails when done via a git post-receive hook, succeeds when the same user runs it via ssh
```shell
remote: npm http 304 https://registry.npmjs.org/uglify-js/1.2.5
remote: npm http 304 https://registry.npmjs.org/xmlhttprequest/1.2.2
remote: npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1
remote: npm http 304 https://registry.npmjs.org/ws
remote: npm ERR! git checkout master fatal: Not a git repository: '.'
remote:
remote: npm ERR! Error: `git "checkout" "master"` failed with 128
remote: npm ERR! at ChildProcess.<anonymous> (/home/prod_web1/local/lib/node_modules/npm/lib/utils/exec.js:58:20)
remote: npm ERR! at ChildProcess.emit (events.js:70:17)
remote: npm ERR! at maybeExit (child_process.js:362:16)
remote: npm ERR! at Socket.<anonymous> (child_process.js:467:7)
remote: npm ERR! at Socket.emit (events.js:67:17)
remote: npm ERR! at Array.<anonymous> (net.js:335:10)
remote: npm ERR! at EventEmitter._tickCallback (node.js:190:38)
remote: npm ERR! You may report this log at:
remote: npm ERR! <http://github.com/isaacs/npm/issues>
remote: npm ERR! or email it to:
remote: npm ERR! <[email protected]>
remote: npm ERR!
remote: npm ERR! System Linux 3.4.2-x86_64-linode25
remote: npm ERR! command "node" "/home/prod_web1/local/bin/npm" "install"
remote: npm ERR! cwd /home/prod_web1/slugs/96e9b06d2094d4b5a006c342be7ca706e8fc0954
remote: npm ERR! node -v v0.6.19
remote: npm ERR! npm -v 1.1.24
remote: npm ERR! message `git "checkout" "master"` failed with 128
```
@hunterloftis
Copy link
Author

Results with env:

Counting objects: 8712, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5201/5201), done.
Writing objects: 100% (8712/8712), 29.25 MiB | 593 KiB/s, done.
Total 8712 (delta 5169), reused 6170 (delta 3300)
remote: git: receiving refs/heads/master, rev. 0000000000000000000000000000000000000000 => 96e9b06d2094d4b5a006c342be7ca706e8fc0954
remote: ENV
remote: MAIL=/var/mail/prod_web1
remote: SSH_CLIENT=70.61.101.162 58083 22
remote: USER=prod_web1
remote: SHLVL=1
remote: GIT_DIR=.
remote: HOME=/home/prod_web1
remote: OLDPWD=/home/prod_web1/repo
remote: LOGNAME=prod_web1
remote: _=/usr/bin/git-receive-pack
remote: PATH=/home/prod_web1/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
remote: LANG=en_US.UTF-8
remote: SHELL=/bin/bash
remote: PWD=/home/prod_web1/slugs/96e9b06d2094d4b5a006c342be7ca706e8fc0954
remote: SSH_CONNECTION=70.61.101.162 58083 66.175.213.8 22
remote: END ENV
remote: npm http GET https://registry.npmjs.org/vows
remote: npm http GET https://registry.npmjs.org/nimbus
remote: npm http GET https://registry.npmjs.org/handlebars
remote: npm http GET https://registry.npmjs.org/commander
remote: npm http GET https://registry.npmjs.org/base12/0.3.2
remote: npm http 304 https://registry.npmjs.org/commander
remote: npm http 304 https://registry.npmjs.org/base12/0.3.2
remote: npm http 200 https://registry.npmjs.org/nimbus
remote: npm http GET https://registry.npmjs.org/nimbus/-/nimbus-0.0.4.tgz
remote: npm http 304 https://registry.npmjs.org/vows
remote: npm http 304 https://registry.npmjs.org/handlebars
remote: npm http 200 https://registry.npmjs.org/nimbus/-/nimbus-0.0.4.tgz
remote: npm http GET https://registry.npmjs.org/commander
remote: npm http GET https://registry.npmjs.org/async
remote: npm http GET https://registry.npmjs.org/underscore
remote: npm http 304 https://registry.npmjs.org/commander
remote: npm http 304 https://registry.npmjs.org/async
remote: npm http 304 https://registry.npmjs.org/underscore
remote: npm http GET https://registry.npmjs.org/underscore
remote: npm http GET https://registry.npmjs.org/async
remote: npm http GET https://registry.npmjs.org/commander
remote: npm http GET https://registry.npmjs.org/jade
remote: npm http 304 https://registry.npmjs.org/underscore
remote: npm http 304 https://registry.npmjs.org/async
remote: npm http 304 https://registry.npmjs.org/commander
remote: npm http 304 https://registry.npmjs.org/jade
remote: npm ERR! git checkout master fatal: Not a git repository: '.'
remote: 
remote: npm ERR! Error: `git "checkout" "master"` failed with 128
remote: npm ERR!     at ChildProcess.<anonymous> (/home/prod_web1/local/lib/node_modules/npm/lib/utils/exec.js:58:20)

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