Git用https proxyを自前鯖のSquidとLet's Encrypt証明書を使って作成する

Let's Encryptの証明書を取得済みのサーバーでsquidの設定ファイルを以下のように修正する。
/etc/squid/squid.conf

# Squid normally listens to port 3128
http_port 3128
https_port 3129 cert=/etc/letsencrypt/live/hostname.example.com/fullchain.pem key=/etc/letsencrypt/live/hostname.example.com/privkey.pem

Gitクライアント側の設定

git config --global http.proxy http://hostname.example.com:3128
git config --global https.proxy https://hostname.example.com:3129

Gitクライアント側の設定(squidBASIC認証を設定している場合)

git config --global http.proxy http://username:password@hostname.example.com:3128
git config --global https.proxy https://username:password@hostname.example.com:3129