问题现象:
在使用gitlab-runner自动部署的时候,git拉取子项目时出现类似错误:Server does not allow request for unadvertised object a99a0b08d8c79fdf8d6745a9e3b.
问题分析:
git客户端在fetch Gitlab指定commit时,出现权限问题是因为gitlab的upload-pack选项默认不允许第三方子项目的提取请求。
解决思路:
编辑gitlab配置文件/opt/gitlab/embedded/etc/gitconfig,设置allowReachableSHA1InWant项为true。命令如下:
[root@localhost]#vi /opt/gitlab/embedded/etc/gitconfig
config
[pack]
threads = 1
[receive]
fsckObjects = true
advertisePushOptions = true
[repack]
writeBitmaps = true
[transfer]
hideRefs=^refs/tmp/
hideRefs=^refs/keep-around/
hideRefs=^refs/remotes/
[core]
alternateRefsCommand="exit 0 #"
fsyncObjectFiles = true
[uploadpack]
allowAnySHA1InWant = true #添加uploadpack设置,允许获取第三方子项目
网友评论