报错如图:
siqi@aliyun-sh-001:~/data-analysis$ git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
error: cannot open .git/FETCH_HEAD: Permission denied
问题分析:
.git/FETCH_HEAD权限没有和用户权限匹配。通过如下命令可以查看该文件权限:
siqi@aliyun-sh-001:~/data-analysis$ ls -lh .git/FETCH_HEAD
-rw-r--r-- 1 root root 0 Mar 26 15:14 .git/FETCH_HEAD
最终解决方案:
赋予该文件夹下所有文件和该用户同等权限
siqi@aliyun-sh-001:~/data-analysis$ sudo chown -R siqi:siqi .git
siqi@aliyun-sh-001:~/data-analysis$ ls -lh .git/FETCH_HEAD
-rw-r--r-- 1 siqi siqi 2.5K Mar 26 15:20 .git/FETCH_HEAD
siqi@aliyun-sh-001:~/data-analysis$ git fetch --all
Fetching origin
remote: Enumerating objects: 12, done.
remote: Counting objects: 100% (12/12), done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 12 (delta 3), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (12/12), 5.19 KiB | 1.73 MiB/s, done.
From gitlab.com:jiangyin-12345/data-analysis
8d623e5..cfa7eee feat-full-download-special-subject -> origin/feat-full-download-special-subject