2013-06-15 11 views
8

私はファイアウォールの内側にあるgitサーバーを持っています。私は自宅からファイアウォールにアクセスできますが、gitサーバーにはアクセスできません。しかし、私はファイアウォールからgitサーバーにアクセスできます(つまり、ファイアウォールにSSHでき、ファイアウォールからgitサーバーにSSHできます)。私は家のマシンからgit reposにプッシュして引っ張ることを望んでおり、SSH ProxyCommandがそれをやると思った。私はssh git_serverを行うことにより、gitのサーバにSSHで直接、この設定でGit、SSH、ProxyCommand

Host git_server 
HostName git_server.dom 
User user_git_server 
IdentityFile ~/.ssh/id_rsa 
ProxyCommand ssh firewall exec nc %h %p 

Host firewall 
HostName firewall.dom 
User user_firewall 
IdentityFile ~/.ssh/id_rsa 

ことができます。だから、私はSSHの設定ファイルに以下を追加しました。しかし、サーバと通信する必要のあるgitコマンドは動作しません。 git remote show originはメッセージで失敗します。

ssh: connect to host git_server.dom port 22: Operation timed out 
fatal: Could not read from remote repository. 

Please make sure you have the correct access rights and the repository exists. 

原点レポのURLが

ssh://[email protected]_server.dom/path/to/bare/repository/repo.git 

である私は、私は場所で物事のほとんどを持っていると思いますが、小さな重要な部分が欠落しています。私が間違ってやっていることへの指針は?

答えて

3
ssh://[email protected]_server.dom/path/to/bare/repository/repo.git 
         ^^^^^^^^^^^^^^ 

あなたのリポジトリのための間違ったURLを使用しています。 ssh設定ファイルにはgit_serverのホストエントリがあるので、そのホスト名をリポジトリURLにも使用する必要があります。そうしないと、SSHはProxyCommandを使用しません。

正しいURLは、どちらか

ssh://[email protected]_server/path/to/bare/repository/repo.git 

または単に

[email protected]_server:/path/to/bare/repository/repo.git 
+2

ハズレでなければならない、それはあまりにも仕事ができます。それは[ssh-uri](http://stackoverflow.com/a/9835653/6309)です。つまり、非[scp構文](http://stackoverflow.com/a/14134674/6309) '〜/ .ssh/config'ファイルを使用してください。また、あなたが推奨するように[scp syntax](http://www.hypexr.org/linux_scp_help.php)を使用する場合は、ユーザ名を指定する必要はありません: 'ssh:// git_server:/ path/to/bare/repository/repo.git'と入力します。そして、あなたは['コロン'](http://en.wikipedia.org/wiki/Colon_%28punctuation%29)で、 'color'ではありません;) – VonC

+0

私は正確にそれがあなたに "Nope "いつssh-uriはssh-configファイルを使用しませんか? – innaM

+0

ああ。これをテストし、コロンは行かなければならない。 – innaM

1

Git clone from remote ssh repository - change the machine on the remote network before executing the clone command」に記載されているように、プロキシサーバーにコマンドnetcatがない可能性があります。

また、another solution with socatもあります。これは、CONNECTメソッドを使用してHTTP(S)プロキシサーバーとネゴシエートし、相手側のサーバーへのクリーンなパイプを取得します。 socatを参照してください。

host gh 
    user git 
    hostname github.com 
    port 22 
    proxycommand socat - PROXY:your.proxy.ip:%h:%p,proxyport=3128,proxyauth=user:pwd 

今、あなただけの(例えば)と言うことができます:

git clone gh:sitaramc/git-notes.git 
関連する問題