Gitlab设置Go私库

Monday, January 18, 2021

Nginx 配置

server {
  listen 80;
  listen 443 ssl http2;
  server_name your.domain;

  ssl_certificate /etc/nginx/certs/your.domain.crt;
  ssl_certificate_key /etc/nginx/certs/your.domain.key;

  access_log /var/log/nginx/gitlab.nginx.log combined;
  error_log /var/log/nginx/gitlab.error.log error;
  index index.html index.htm index.php;
  if ($args ~* "^go-get=1") {
    set $condition goget;
  }
  if ($uri ~ ^/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$) {
    set $condition "${condition}path";
  }
  if ($condition = gogetpath) {
    return 200 "<!DOCTYPE html><html><head><meta content='your.domain$uri git ssh://[email protected]:port$uri.git' name='go-import'></head></html>";
  }
  location / {
    proxy_pass http://ip:port;
  }
}
Git Gitlab Go

Git 导出提交记录go学习笔记