可以使用openssl生成自签名证书和密钥:
openssl genrsa -out gitlab.key 2048
openssl req -new -key gitlab.key -out gitlab.csr
openssl x509 -req -days 365 -in gitlab.csr -signkey gitlab.key -out gitlab.crt
在Gitlab的配置文件中,添加以下配置项:
gitlab_rails['gitlab_shell_ssh_port'] = 22 gitlab_rails['lfs_enabled'] = true gitlab_rails['lfs_storage_path'] = "/mnt/data/repositorie/LFS" gitlab_workhorse['auth_backend'] = "http://localhost:8080"
对于Git客户端,需要配置Git LFS和证书:
git lfs install
git config --global http.sslCAInfo /path/to/gitlab.crt
git config --global lfs.https://your-gitlab-server-url.com/info/lfs.access=your-private-token
完成以上步骤后,需要重启Gitlab服务使配置生效:
sudo gitlab-ctl restart
现在,您可以尝试从Gitlab仓库中拉取LFS文件,如果一切正常,您应该可以成功获取LFS文件。