Title: Wrong Path for Git
Last modified: November 21, 2016

---

# Wrong Path for Git

 *  [jasonmj](https://wordpress.org/support/users/jasonmj/)
 * (@jasonmj)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wrong-path-for-git/)
 * Hi there, I’m really enjoying your plugin. I got it setup successfully on one
   server, but I’m having trouble with it on another. This appears to be a path 
   issue. I am seeing “There is no git installed on this server” in WordPress and
   command not found for Git in the server logs.
 * However, I am certain that Git is installed and the web user has access to use
   it. I did some testing to check on the path and it appears that proc_open needs
   a custom env path in this case:
 * ============================
    <?php
 * $descriptorspec = array(
    0 => array(“pipe”, “r”), 1 => array(“pipe”, “w”), 2
   => array(“file”, “/home/www/domain.com/tmp/error-output.txt”, “a”) );
 * $env = array(
    ‘PATH’ => ‘/usr/local/bin’ //Path to bin dir to pick up git executable);
 * $process = proc_open(“git –version”, $descriptorspec, $pipes, __DIR__, $env);
 * echo stream_get_contents($pipes[1]);
    fclose($pipes[1]);
 * ?>
    =============================
 * The code above illustrates how it could be done on this server. It seems like
   I’d need to modify the plugin code to get this working, but perhaps there’s a
   better way. Any ideas?
 * Thanks again for such a great plugin. It’s definitely a time saver for new site
   configs and version control.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wrong-path-for-git/#post-8469264)
 * Thanks a lot for your feedback! It seems that a filter can solve this issue. 
   Can you try to use the gitium code from git_path branch [https://github.com/PressLabs/gitium/archive/git_path.zip](https://github.com/PressLabs/gitium/archive/git_path.zip)
   and add the folowing code as a new plugin?
 *     ```
       /**
        * Plugin Name: Gitium Custom Config
        */
       add_action( 'plugins_loaded', 'gitium_custom_config' );
       function gitium_custom_config() {
       	add_filter( 'gitium_git_bin_path', function( $git_bin_path ) {
       		return '/usr/local/bin/';
       	});
       }
       ```
   
 *  Thread Starter [jasonmj](https://wordpress.org/support/users/jasonmj/)
 * (@jasonmj)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wrong-path-for-git/#post-8475358)
 * Excellent! That worked for resolving the git path issue, but unfortunately, when
   I merged my changes, the plugin deleted most of wp-content from the install. 
   Heh, good thing it was just a local test environment 😉
 * I’m not sure why, but I tried it twice now, and the contents of my theme and 
   plugins folders get removed leaving only a few directories inside.
 *  Plugin Author [Presslabs](https://wordpress.org/support/users/presslabs/)
 * (@presslabs)
 * [9 years, 6 months ago](https://wordpress.org/support/topic/wrong-path-for-git/#post-8477697)
 * Can you try to reproduce it again with the docker env. see [https://www.presslabs.com/help/gitium/testing#build-your-own-wordpress-local-environment-using-docker–mywordpressdocker-](https://www.presslabs.com/help/gitium/testing#build-your-own-wordpress-local-environment-using-docker–mywordpressdocker-)
   and set the constant WP_DEBUG=True and then send me the logs after you reproduce
   it locally?
 * Can you also send me the steps to reproduce(STR).
 * The STR will help me to debug and fix the issue [https://github.com/PressLabs/gitium/issues/129](https://github.com/PressLabs/gitium/issues/129)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Wrong Path for Git’ is closed to new replies.

 * ![](https://ps.w.org/gitium/assets/icon-128x128.png?rev=1610345)
 * [Gitium](https://wordpress.org/plugins/gitium/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gitium/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gitium/)
 * [Active Topics](https://wordpress.org/support/plugin/gitium/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gitium/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gitium/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [Presslabs](https://wordpress.org/support/users/presslabs/)
 * Last activity: [9 years, 6 months ago](https://wordpress.org/support/topic/wrong-path-for-git/#post-8477697)
 * Status: not resolved