Skip to content

Instantly share code, notes, and snippets.

@tkuchiki
Last active December 20, 2015 14:19
Show Gist options
  • Save tkuchiki/6145491 to your computer and use it in GitHub Desktop.
Save tkuchiki/6145491 to your computer and use it in GitHub Desktop.
git:// を proxy 経由で、git clone する際に使うスクリプト。環境変数 http_proxy を使用。
#!/usr/bin/perl
$ENV{'http_proxy'} =~ m|^https?://(.+?):?(\d+)?(/.*)?$|;
unless ($1 || $2) {
print "http_proxy is invalid\n";
exit 1;
}
my $domain = $1;
my $port = $2 || 80;
$corkscrew = `which corkscrew 2> /dev/null`;
if ($?) {
print "corkscrew is not found.\n";
exit 1;
}
chomp($corkscrew);
system("${corkscrew} ${domain} ${port} ${ARGV[0]} ${ARGV[1]}");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment