Git commit 无法打开‘.git/COMMIT_EDITMSG’:权限被拒绝

Git commit 无法打开‘.git/COMMIT_EDITMSG’:权限被拒绝

我在共享服务器中的存储库中遇到了“权限被拒绝”的情况。我尝试了从其他堆栈中找到的一些解决方案,但未能解决我的问题。

还有什么我应该尝试的吗?

-bash-4.1$ chown -R $(whoami) .git
-bash-4.1$ git commit -m "added some more scripts"
fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
-bash-4.1$ chmod 777 .git
-bash-4.1$ git commit -m "added some more scripts"
fatal: could not open '.git/COMMIT_EDITMSG': Permission denied
-bash-4.1$ ls -al .git
total 9
drwxrwxrwx  13 yj2429 dune  512 Sep  3 11:27 .
drwxr-xr-x  44 yj2429 dune  512 Sep  3 11:11 ..
-rw-r--r--   1 yj2429 dune   19 Sep  3 11:13 COMMIT_EDITMSG
-rw-r--r--   1 yj2429 dune   23 Aug  2 14:04 HEAD
drwxr-xr-x   2 yj2429 dune  512 Aug  2 14:04 branches
-rw-r--r--   1 yj2429 dune  261 Aug  2 14:44 config
-rw-r--r--   1 yj2429 dune   73 Aug  2 14:04 description
drwxr-xr-x  13 yj2429 dune  512 Aug  2 14:04 hooks
-rw-r--r--   1 yj2429 dune 2773 Sep  3 11:27 index
drwxr-xr-x   3 yj2429 dune  512 Aug  2 14:04 info
drwxr-xr-x   4 yj2429 dune  512 Sep  3 11:02 logs
drwxr-xr-x 241 yj2429 dune  512 Sep  3 10:52 objects
drwxr-xr-x   5 yj2429 dune  512 Aug  2 14:44 refs

答案1

rm .git/COMMIT_EDITMSG 
rm .git/logs/HEAD
rm .git/logs/refs/heads/master

看起来像一个快速解决办法...

相关内容