LoginSignup
0
0

More than 3 years have passed since last update.

Gitサブモジュールでホスト名が解消できなかった

Posted at

はじめに

GitHubにて、サブモジュールを含むリポジトリをクローンしようとしたところ、
サブモジュールのupdateでこけた。
通常のリポジトリはクローンできたのになぜ?

Cloning into 'XXX'...
ssh: Could not resolve hostname github: Temporary failure in name resolution
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'github:XXX/xxx.git' into submodule path 'xxx' failed

状況

  • GitHubにパブリックキーは登録済み
  • 通常のリポジトリはクローンできた
  • git submodule updateコマンドを打つと、上記エラーが発生

解消

「githubというホスト名を解消できませんでした」のようなエラー文。
sshのconfigファイルを作成すれば直るのでは?と思い作成。

Host github
        HostName github.com
        User git
        IdentityFile xxx/.ssh/id_rsa

設定すると、ちゃんとクローンできた!

見解

SSH経由でサブモジュールまでクローンしようとすると、合わせて2種類のリポジトリをクローンすることになる。
configファイルで設定していないと、ホスト名かSSHキーかわからないが、うまく認識できないものと思われる。

終わりに

まだまだGitを使いこなすには時間がかかりそう。
いっぱい使いながら、もっと学んでいかないとなと改めて思った。


最後まで読んでいただきありがとうございます。
認識が違っている点などがあれば、ぜひご指摘ください!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0