LoginSignup
6
2

More than 3 years have passed since last update.

git submoduleにprivateレポジトリを追加した際の注意点

Last updated at Posted at 2019-06-21

GitHubでSubmodule使ってた際に躓いたのでレポート


SubmoduleとしてPrivateレポジトリを追加している既存のレポジトリをクローンした時に、git submodule updateでパーミッションエラーが出た。

(エラーメッセージから一部抜粋)git@github.com: Permission denied (publickey).
とあるようにgit@github.comとしてアクセス拒否されている、モジュールを追加してる大元のレポジトリにある.gitmodulesを見てみると以下のようになっていた

[submodule "hoge"]
     path = hoge
     url = git@github.com:FOO/hoge.git

ここのurlをSSHじゃなくHTTPS経由に変更する

[submodule "hoge"]
     path = hoge
     url = https://github.com/FOO/hoge.git

これでsubmodule updateでエラーが起こらなくなる

6
2
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
6
2