Homelab: A self-hosted GitHub Accelerator

# homelab # proxy # github  · 208 words · One minute · Pbulished On: June 17, 2023 (Last updated on: June 17, 2023)

In general, there are multiple ways for you to accelerate the git pull / git push or download the release/source code from GitHub:

  1. You may directly use a HTTP/HTTPS/SOCK5 proxy in your terminal export https_proxy=https://[ip]:[port] http_proxy=http://[ip]:[port]
  2. You may use a public github-proxy, e.g. ghproxy.com or gh-proxy.com

You can also build a self-hosted ghproxy-liked web service to avoid data leakage (if there is). With docker, you can set up the service in one or two minutes:

version: "3"
    image: stilleshan/gh-proxy
    container_name: gh-proxy
      - 12345:80
    restart: always

With nginx you can proxy the service to a sub-domain:

# Upstream where your authentik server is hosted.
upstream ghproxy {
    # Improve performance by keeping some connections alive.
    keepalive 10;

# Upgrade WebSocket if requested, otherwise use keepalive
map $http_upgrade $connection_upgrade_keepalive {
    default upgrade;
    ''      '';

server {
    # HTTP server config
    listen 80;
    server_name ghproxy.example.com;

    # 301 redirect to HTTPS
    location / {
            return 301 https://$host$request_uri;

server {
    # HTTPS server config
    listen 443 ssl http2;
    server_name ghproxy.example.com;

    # TLS certificates
    ssl_certificate /var/www/ssl/example.com.crt;
    ssl_certificate_key /var/www/ssl/example.com.key;

    # Proxy site
    location / {
        proxy_pass http://ghproxy;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $host;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade_keepalive;