The following commands
$ git co -b newbranch
$ git co oldbranch
result in "fatal: cannot exec 'git-co': Permission denied" error.
In the same time,
$ git checkout -b newbranch
$ git checkout oldbranch
and
$ sudo git co -b newbranch
$ sudo git co oldbranch
work as expected. Ownership rights for the .git folder are set for the user owning the home folder and 0755/0644 are the mode for .git folder/subfolder/files. There are no git-co
script anywhere in the system (that is an expandable alias to git-checkout
, which resides in /usr/libexec/git-core` dir).
Aliases are defined in .gitconfig
of the home folder:
[alias]
co = checkout
There is no difference in git config -l
output for root or unprivileged user. Still sudo git co oldbranch
works and git co oldbranch
does not.
What am I missing?
Gentoo / kernel 3.0.6 / git 1.7.3.4
The correct answer to this was actually different. Before git runs the aliases it checks the $PATH
. In case the directory does not exist, or lacks permissions, git produces the "fatal: cannot exec 'git-co': Permission denied"
. It does not ever comes to check the aliases so git foobar
will produce the same error.
Good people from the git mailing list also reminded me of an strace
tool, that can help finding the entry that is returning EACCES, as in: strace -f -e execve git foobar
The credit goes to Jeff King from the git mailing list. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With