I would like to launch git commands, on my production server, from my pc. The document root of the production application is a clone of the git repository.

On prod, on sites/all/drush/drushrc.php I've add this line:


// Drush aliases
$options['shell-aliases']['git-status'] = '!git status';

If I login on production and I execute "git status", everything works.

If I try to execute, from my pc "drush @mysite.prod git-status" I obtain:

fatal: Not a git repository (or any of the parent directories): .git
Command git status failed.

Note that if I try to run "drush @mysite.local git-status", works (and my local copy is like the production copy, the document root is the clone of git repository).

What's wrong? Document root directory declared on my alias is right (other commons drush commands work) and is a checkout of git repository.


1 Answer 1


This works just fine for me on both the 6.x and master branches of Drush, and on the 6.2.0 release. So, your first step would be to try with the latest versions, and see if it works. If that doesn't fix your problem, try running your command again using the -v flag to get more verbose output. You will see something like this:

$ drush -v @mysite.prod git-status
Loaded alias @server.xxxxxxxxxxx from file                              [notice]
Loaded alias @mysite.prod from file                                     [notice]
Include /home/ga/local/drupal/drush_extensions                          [notice]
Include /home/ga/.drush                                                 [notice]
Calling proc_open(ssh -o PasswordAuthentication=no [email protected] 'cd /srv/www/myserver.com/htdocs && git status');
# On branch master
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#   ../xxxxx.txt
nothing added to commit but untracked files present (use "git add" to track)
Command dispatch complete                                               [notice]

Try running the command inside of "proc_open(...)" from the shell, and see if it behaves the same way. Adjust the ssh options until it works right. Then, set $options['ssh-options'] to adjust.


If you want to do something like this without defining a shell alias, the following should also work:

drush @mysite.prod ssh git status
  • But how have you defined the "git-status" command?
    – arrubiu
    Mar 31, 2014 at 6:21
  • I copied your git-status alias from the question. I put it into the .drushrc file on my local system; I did not need to define it on the remote system. That probably does not work on Drush 5.x, but it works on Drush 6 and later. Mar 31, 2014 at 18:21
  • Now I can't try. I'm using drush 6, asap I'll try it
    – arrubiu
    Apr 1, 2014 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.