• Hi,
    I just installed the plugin “Display Git Status” and I wanted to try it out. But all the time I get the message

    The saved location is not a git repository! The git status menu item will be hidden from view.

    In the text field “Git Repository Location” I entered the value /var/www/html/wp-content. This directory is a local git repository. When I change into that directory and enter the command git rev-parse --abbrev-ref HEAD, I get master as result. “ls -al” in that directory gives me this

    root@beb35a1d43af:/var/www/html/wp-content# ls -al
    total 36
    drwxrwxrwx 8 www-data www-data 4096 Jan 19 22:31 .
    drwxrwxrwx 5 www-data www-data 4096 Jan 19 22:24 ..
    drwxr-xr-x 8 www-data www-data 4096 Jan 19 22:30 .git
    drwxrwxrwx 2 www-data www-data 4096 Jan 12 22:50 cache
    -rw-r–r– 1 www-data www-data 28 Jan 8 2012 index.php
    drwxrwxrwx 4 www-data www-data 4096 Jan 19 21:56 languages
    drwxr-xr-x 4 www-data www-data 4096 Jan 19 21:56 plugins
    drwxr-xr-x 5 www-data www-data 4096 Dec 8 22:13 themes
    drwxrwxrwx 2 www-data www-data 4096 Jan 19 21:56 upgrade

    So, as far as I know I should something else than the error message above. So, why is that ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WP Git Updater

    (@wpgitupdater)

    Is there any way you could check the web php user has access to the shell_exec function. You can usually do this by checking safe mode is off and the function is not in the disabled functions config when displaying phpinfo();.

    When the function is disabled the plugin will just return empty strings for any of the commands executed which may be why your unable to view the branch.

    Addiitonally thanks for the output in your submission, it does look like the .git folder has the correct permission for use by the web user. as a final sanity check it might be worth just making sure the files and directories inside the .git folder have the same user and permissions to allow access from the web php process.

    Thread Starter masterdevops

    (@masterdevops)

    To check if shell_exec is enabled I used this code

    
    <?php
    
            if(function_exists('shell_exec')) {
                echo "exec is enabled\n";
            }
    
    ?>
    

    and called it with php file.php on the command line. The result was that I got the message exec is enabled. I did it with the same user name as apache is running (i.e. www-data).

    I also checked the correct ownership of the file under /var/www/html/wp-content/.git and there were files which had root as username and group. I changed it to www-data (including subdirectories) but the error message is still showing up.

    
    root@beb35a1d43af:/var/www/html/wp-content/.git# ls -al
    total 104
    drwxr-xr-x   8 www-data www-data  4096 Jan 19 23:06 .
    drwxrwxrwx   8 www-data www-data  4096 Jan 19 22:31 ..
    -rw-r--r--   1 www-data www-data    14 Jan 19 22:12 COMMIT_EDITMSG
    -rw-r--r--   1 www-data www-data    20 Jan 19 22:43 HEAD
    drwxr-xr-x   2 www-data www-data  4096 Jan 19 22:10 branches
    -rw-r--r--   1 www-data www-data    92 Jan 19 22:10 config
    -rw-r--r--   1 www-data www-data    73 Jan 19 22:10 description
    drwxr-xr-x   2 www-data www-data  4096 Jan 19 22:10 hooks
    -rw-r--r--   1 www-data www-data 55115 Jan 19 23:06 index
    drwxr-xr-x   2 www-data www-data  4096 Jan 19 22:10 info
    drwxr-xr-x   3 www-data www-data  4096 Jan 19 22:12 logs
    drwxr-xr-x 234 www-data www-data  4096 Jan 19 22:11 objects
    drwxr-xr-x   4 www-data www-data  4096 Jan 19 22:10 refs
    
    Plugin Author WP Git Updater

    (@wpgitupdater)

    Hello again,

    in your php script could you try this and see if there is any output, just like you did for the phpinfo test please:

    
    <?php
    echo shell_exec('git rev-parse --abbrev-ref HEAD');
    
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘The saved location is not a git repository!’ is closed to new replies.