リモート リポジトリ用にローカル Git プロジェクトを設定しています。リモート リポジトリは非標準ポート (4019) で提供されています。
しかし、それは機能しません。代わりに、次のエラー メッセージが表示されます。
ssh: connect to host git.host.de:4019 port 22: Connection refused
fatal: The remote end hung up unexpectedly
error: failed to push to 'ssh://[email protected]:4019/var/cache/git/project.git'
私のローカルgit設定は次のように:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ssh://[email protected]:4019/var/cache/git/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
(ポートとホストは、実際のポートとホストのプレースホルダーです。)
私の git 設定の何が問題なのでしょうか?
ベストアンサー1
<repo_path>/.git/config
SSHベースのgitアクセス方法は、完全なURLまたはSCPのような構文を使用して指定できます。git クローン:
URL スタイル:
url = ssh://[user@]host.xz[:port]/path/to/repo.git/
SCPスタイル:
url = [user@]host.xz:path/to/repo.git/
SCP スタイルでは直接ポートを変更できず、代わりに次のようなssh_config
ホスト定義に依存することに注意してください~/.ssh/config
。
Host my_git_host
HostName git.some.host.org
Port 24589
User not_a_root_user
次に、シェルで次のようにテストします。
ssh my_git_host
SCP スタイルの URI を<repo_path>/.git/config
次のように変更します。
url = my_git_host:path/to/repo.git/