问题描述

Git 报错:没有权限,日志如下所示:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
INFO  Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
[master ee305c2a] Site updated: 2023-01-23 23:10:20
473 files changed, 2752 insertions(+), 1850 deletions(-)
create mode 100644 769c5416.html
create mode 100644 categories/IDE/Chrome/index.html
create mode 100644 tags/Chrome/index.html
Enumerating objects: 1244, done.
Counting objects: 100% (1244/1244), done.
Delta compression using up to 8 threads
Compressing objects: 100% (522/522), done.
Writing objects: 100% (701/701), 328.19 KiB | 898.00 KiB/s, done.
Total 701 (delta 473), reused 0 (delta 0), pack-reused 0
remote: error: unable to unlink old 'newdir/index.html' (Permission denied)
remote: error: unable to unlink old 'newdir/childhood.html' (Permission denied)
remote: error: unable to unlink old 'newdir/jptown.html' (Permission denied)
remote: error: unable to unlink old 'newdir/ktface.html' (Permission denied)
remote: error: unable to unlink old 'newdir/shface.html' (Permission denied)

解决办法

1
chown -R git:git newdir

问题分析

后续新增的目录没有授予git用户权限,因此会出现以上的错误提示。