.git is a hidden directory, so make sure you have that option enabled when viewing the file system on your server. Check in the WP root directory.
Thanks Steven,
I can see other hidden directories and files such .htaccess
The hidden files and folders I can see in the server root are:
.cache
.composer
.config
.local
.mysql_history
.npm
.pki
.profile
.ssh
.wp-cli
.wp-toolkit
The ones in httpdocs are:
.htaccess
.user.ini
.well-known
The only one in wp-content is:
.htaccess
There is no .git anywhere.
Yet when I check my WP Site Health it still says:
The folder / was detected as being under version control (.git).
I am completely at a loss as to what could be causing this…
I think it’s responding to “.composer” and “.npm”, as those are used for automated processes like installs. Do you have the website installed in your home directory?
OK, I have renamed .composer to composer_BAK and .npm to npm_BAK
It still says “The folder / was detected as being under version control (.git).”
I’m not quite sure if the website is installed in my home directory.
The website is installed in the httpdocs directory
It’s a VPS, and the directory structure is:
/var/www/vhosts/mydomain.co.uk/httpdocs/wp-content/
Is this actively blocking you from installing updates?
No, I can still install updates manually I think.
But I just discovered it has prevented auto-updates from being installed for the last few months!
I use WordPress Multisite, so plugin updates are installed at the network level. I don’t know if that makes any difference to the .git error…?
/var/www/vhosts/mydomain.co.uk/httpdocs/wp-content/
it is telling you there is a .git in root i.e. /.git
As it walks all the way up.
Well here is the code
// Walk up from $context_dir to the root.
do {
$check_dirs[] = $context_dir;
// Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here.
So it looks at all directories upwards so look for .git above your install path
-
This reply was modified 4 years, 12 months ago by
Alan Fuller.
p.s.
You can force automatic updater to ignore the .git with a filter
add_filter( 'automatic_updates_is_vcs_checkout', __return_false() );
see https://developer.ww.wp.xz.cn/reference/hooks/automatic_updates_is_vcs_checkout/
-
This reply was modified 4 years, 12 months ago by
Alan Fuller.
Great, thank you Alan!
I’ll check with my web host about why that .git directory is in the root folder, I don’t even have access to that.
Thanks for the tip about the filter, that’s really useful