Git push error: Unable to unlink old (Permission denied)

前端 未结 14 1158
庸人自扰
庸人自扰 2020-11-29 16:32

In the remote server I have a post-receive hook set up in order to make a git checkout of my repository:

#!/bin/sh
GIT_WORK_TREE=/var/www/ git         


        
相关标签:
14条回答
  • 2020-11-29 17:00
    sudo chmod -R ug+w .;
    

    This command would fix the issue. It gives write permissions to the folder.

    0 讨论(0)
  • 2020-11-29 17:05

    FWIW - I had a similar problem and I'm not sure if this alleviated it (beyond the permission mod): Closing Eclipse that was using the branch with this problem.

    0 讨论(0)
  • 2020-11-29 17:06
    git reset --hard
    

    Worked for me

    0 讨论(0)
  • 2020-11-29 17:07

    When you have to unlink file, you have to have permission 'w' for directory, in which file is, not for the file...

    0 讨论(0)
  • 2020-11-29 17:07

    Pulling may have created local change.

    Add your untracked file:

    git add .

    Stash changes.

    git stash

    Drop local changes.

    git stash drop

    Pull with sudo permission

    sudo git pull remote branch

    0 讨论(0)
  • 2020-11-29 17:12
    sudo chown -R $USER:$USER .
    

    Did the job for me.

    0 讨论(0)
提交回复
热议问题