0

Using Debian 9 Stretch server, Windows 7 Pro workstation, Git Extensions to handle GIT.

I have a git user using key to login to server.

When I push commit to server I get this error

C:\winprg\Git\bin\git.exe push --recurse-submodules=on-demand --progress "sites" refs/heads/fix_commit:refs/heads/fix_commit
Counting objects: 4, done.
Delta compression using up to 4 threads.
Total 4 (delta 3), reused 0 (delta 0)
error: unable to unlink old 'commit/config.php': Permission denied
To ssh://192.168.1.1/srv/git/sites.git
 ! [remote rejected]         fix_commit -> fix_commit (Could not update working tree to new HEAD)
error: failed to push some refs to 'ssh://git@192.168.1.1/srv/git/sites.git'

I store git repo in: /srv/git/sites.git All files under /srv/git/sites.git has owner git:git.

I store webserver content on path: /srv/sites/mysite/htdocs All files under /srv/sites/mysite/htdocs has owner www-data:www-data.

git user is member of www-data group.

www-data user is member of git group.

Still having permission problem.

EDIT1: also when doing checkout in commandline, I get :

git@site:/srv/git/sites.git$ git checkout -f fix_commit
error: unable to unlink old 'commit/config.php': Permission denied

How do I fix it?

klor
  • 1,237
  • 4
  • 12
  • 37
  • 1
    Seems to be a dup. https://stackoverflow.com/questions/11774397/git-push-error-unable-to-unlink-old-permission-denied – triplem Sep 25 '18 at 11:28
  • `sudo chmod -R g+w *` did not help, still getting permission denied error. Thus, it seems not a dup. – klor Sep 25 '18 at 11:50
  • @klor No, I agree with the dupe target. There are at least 3 other options mentioned in the answers there that you haven't tried. Don't just look for the answers with the code, you should read and understand what the problem is. Also, I hope for your sake you haven't executed that command blindly, that could seriously harm your system if you do it from an incorrect directory. – Madara's Ghost Sep 25 '18 at 12:14
  • Of course I executed in the htdocs directory. – klor Sep 25 '18 at 12:20

0 Answers0