Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Is it possible you have inadvertently created a non-executable <code>git-co</code> file somewhere? I can recreate your situation if I do just that, as demonstrated below.</p> <pre><code>$ git --version git version 1.7.7.1.475.g997a1 $ git config --get-regexp '^alias\.co$' alias.co checkout $ git co b1 Switched to branch 'b1' $ touch $HOME/bin/git-co $ ls -al $HOME/bin/git-co -rw-r--r-- 1 user user 0 2011-11-03 12:59 /home/user/bin/git-co $ git co master fatal: cannot exec 'git-co': Permission denied $ for p in $(echo "$PATH" | sed -e 's/:/ /g'); do if [ -f "${p}/git-co" ]; then echo "Found git-co in ${p}"; fi; done Found git-co in /home/user/bin $ rm $HOME/bin/git-co rm: remove regular empty file `/home/user/bin/git-co'? y $ git co master Switched to branch 'master' </code></pre> <p>Another thing you might want to try is enabling trace logging to get more information about what Git is doing. Following is an example:</p> <pre><code>GIT_TRACE=$HOME/trace.log git co master </code></pre> <p>You must use <strong>absolute</strong> paths if you want to send output to a file. Otherwise, use <code>true</code> or <code>1</code> to send output to standard error; e.g. <code>GIT_TRACE=1</code>. The <code>trace.log</code> file contains:</p> <pre><code>trace: exec: 'git-co' 'master' trace: run_command: 'git-co' 'master' trace: alias expansion: co =&gt; 'checkout' trace: built-in: git 'checkout' 'master' </code></pre> <p>If you do not see the <code>trace: alias expansion: co=&gt; 'checkout'</code> trace log output, Git is finding a <code>git-co</code> file in the <code>PATH</code> environment variable. Git uses a <code>PATH</code> as follows:</p> <ol> <li>Start with an empty <code>PATH</code>, saving any "old" <code>PATH</code> for reference.</li> <li>If the <code>--exec-path=&lt;my git commands path&gt;</code> Git option is found, append <code>&lt;my git commands path&gt;</code> to the <code>PATH</code>.</li> <li>If <code>--exec-path=&lt;my git commands path&gt;</code> was not found and the <code>GIT_EXEC_PATH</code> environment variable is set, append this to the <code>PATH</code>.</li> <li>If you called <code>git</code> using a relative or absolute path, append the absolute path of the <code>git</code> executable to the <code>PATH</code>.</li> <li>If <code>PATH</code> was previously defined, append it to the <code>PATH</code>.</li> <li>If <code>PATH</code> was not previously defined, append <code>/usr/local/bin:/usr/bin:/bin</code> to the <code>PATH</code>.</li> </ol> <p>You can use another alias to get Git to tell you what it is setting the <code>PATH</code> environment variable to.</p> <pre><code>$ git config --global alias.whatpath '!echo $PATH' $ git whatpath /usr/local/libexec/git-core:/home/user/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin </code></pre> <p>Then check each directory listed for the existence of a <code>git-co</code> file. It's not sufficient to do <code>which git-co</code> and assume that if nothing is found that you do not have a <code>git-co</code> file located in one of the directories in Git's <code>PATH</code>; a file may exist that is not executable and <code>which</code> will not display it.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload