ラベル git の投稿を表示しています。 すべての投稿を表示
ラベル git の投稿を表示しています。 すべての投稿を表示

2013年11月13日水曜日

gitリポジトリを引っ越す

mirrorオプションをつけて実行する。
$ git clone --mirror git@before.example.com:hogeuser/Sample.git
$ cd Sample.git
$ git push --mirror git@after.example.net:foouser/Sample.git

[参考URL]
What's the difference between git clone --mirror and git clone --bare

2013年9月7日土曜日

プロキシ環境下でgitを使う

プロキシの設定


下記の通りプロキシ設定する。
$ git config --global http.proxy http://proxy.example.com:8080
$ git config --global https.proxy http://proxy.example.com:8080

これで手動でhttpまたはhttpsスキームを指定したgit clone等ができるようになる。
$ git clone https://github.com/joyent/node.git

gitスキームのまま使いたい場合(通常はこのケースが多いだろう)は下記を追加設定する。
$ git config --global url."https://".insteadOf git://

これでgitスキームのままgit clone等ができるようになる。
$ git clone git://github.com/joyent/node.git


プロキシ設定の確認


gitコマンドによる確認
$ git config --list
(該当箇所のみ抜粋)
http.proxy=http://proxy.example.com:8080
https.proxy=http://proxy.example.com:8080
url.https://.insteadof=git://

.gitconfigファイルの確認
$ less ~/.gitconfig
(該当箇所のみ抜粋)
[http]
        proxy = http://proxy.example.com:8080
[https]
        proxy = http://proxy.example.com:8080
[url "https://"]
        insteadOf = git://


プロキシ指定についての補足

認証付きプロキシサーバの場合は認証ID、PW込みでプロキシ指定する。また、認証ID、PW、プロキシサーバURLにURIとして使用できない文字(@等)が含まれる場合はURLエンコードすること。

書式
$ git config --global http.proxy http://認証ID:認証PW@プロキシサーバのURL:ポート番号
$ git config --global https.proxy http://認証ID:認証PW@プロキシサーバのURL:ポート番号

設定例(認証IDがfoo.bar@example.com、認証PWがhogepassの場合)
$ git config --global http.proxy http://foo.bar%40example.com:hogepass@proxy.example.com:8080
$ git config --global https.proxy http://foo.bar%40example.com:hogepass@proxy.example.com:8080