Plesk

Error when accessing Git extension in Plesk: Failed to change directory to /var/www/vhosts/example.com/git/repository: No such file or directory

Symptoms

filemng: Failed to change directory to /var/www/vhosts/example.com/git/repository: No such file or directory System error 2: No such file or directory 

# ls -l /var/www/vhosts/example.com/git/repository
ls: /var/www/vhosts/example.com/git/repository: No such file or directory

Cause

The remote repository was not cloned successfully.

Resolution

1. Connect to the server via SSH

2. Back up the Git extension's SQLite database:

# cp -a /usr/local/psa/var/modules/git/git_db.db{,.backup}

3. Access the Git extension's database via SQLite client:

# sqlite3 /usr/local/psa/var/modules/git/git_db.db

4. List all configured repositories:

select * from Repositories;
1|185|Repo1|pull|auto|main|httpdocs|git@github.com:repo/repo.git|123abc-4def-5ghi-6jkl-789mnopqrst|||||0
5|356|Repo2|pull|auto|master|/|https://github.com/|123abc-4def-5ghi-6jkl-789mnopqrst|||||27

5. Remove the misconfigured repository:

Note: the example below is using a placeholder value, replace it with the actual repository's ID

delete from Repositories where id = 5;