git の ssh 記述方法ですが,これまでずっと
ssh://hoge@hoge.com:/home/hoge/hoge.git
みたいに記述してました.これで特に問題なく使えてました.で,centos で同様に記述して git コマンド実行.
% git pull
ssh: Could not resolve hostname hoge.com:: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
%
ん!?動作しない.と思って man git-clone したら
ssh://[user@]host.xz[:port]/path/to/repo.git/
とのこと.どうやら : (コロン) の後にはポート番号が入るのが正解で,パスを書く時にコロンを入れる必要はないみたいだね.
ということで,.git/config の中を書き換えて ssh://hoge@hoge.com/home/hoge/hoge.git に記述修正.無事通りました.
でも,これまでずーっとこの記述を使っていたけど Windows Client/Mac Client/Debian/Ubuntu とかで問題なかったのはどうしてなんだろう.引っかかったのは CentOS の git だけ.CentOS7 の git は
% git --version
git version 1.8.3.1
ってことで古いから引っかかったのかな?
まぁ,本来はパスの前にコロンをつける必要はないってことで,今後は全部の環境でコロンをつけない形に修正しておこうかな.
ただ,git のマニュアルには
An alternative scp-like syntax may also be used with the ssh protocol:
· [user@]host.xz:path/to/repo.git/
ってことも書いてるんで CentOS でも通っても良さそうだけど,ちょっと謎.