LoginSignup
0
0

More than 5 years have passed since last update.

Dynamic Port Forwarding経由でgit clone

Posted at

想定環境

  • あるLAN内からでないとアクセスできないサーバgitserver.hoge.com上にあるGitリポジトリからgit cloneしたい
  • アクセスにはDynamic Port Forwardingを利用したい
    • ゲートウェイサーバgateway.hoge.comを経由することにする

アンチパターン

  • イヤな例: git config --globalでプロキシを設定
    • 利用するリポジトリ全てで適用されてほしくない

結論

git cloneの--configオプションを使えば今から引っ張ってくるリポジトリのみに適用できる

方法

Dynamic Port Forwardingする

$ ssh -Nf gateway -D 8080

この状態でlocalhost:8080にアクセスすれば,gatewayを経由したアクセスになる.

git cloneする

$ git clone --config http.proxy=socks5://localhost:8080 http://gitserver.hoge.com/fuga
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0