Git Aliases “cannot exec”

I ran into a problem when attempting to use git aliases.

[git@git hello]$ git hist
fatal: cannot exec 'git-hist': Permission denied

Turns out the issue was because I had logged in as user “git” via the su command but had neglected to use the – (minus)

When I logged in directly as user git or from root using ‘su -l git‘ everything worked as advertised.

I got the clue to the problem from running strace.

[git@git hello]$ strace -f -e execve git hist
execve("/usr/bin/git", ["git", "hist"], [/* 21 vars */]) = 0
Process 1560 attached
[pid  1560] execve("/usr/libexec/git-core/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/usr/local/sbin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/usr/local/bin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/sbin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/bin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/usr/sbin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/usr/bin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 ENOENT (No such file or directory)
[pid  1560] execve("/root/bin/git-hist", ["git-hist"], [/* 21 vars */]) = -1 EACCES (Permission denied)
fatal: cannot exec 'git-hist': Permission denied

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s