heroku + git submodule needs authentication

2019-06-18 11:04发布

We are using gitolite to manage our repositories and one of our heroku project's have git submodules. Is there a way to get Heroku's public key for the authentication?

Thanks, David

3条回答
放我归山
2楼-- · 2019-06-18 11:14

You can also commit a .ssh directory containing a dedicated id_rsa key ("deployment key") that is registered with github, either with your account or a dedicated deployment account. Don't forget to chmod 0660 the key.

查看更多
smile是对你的礼貌
3楼-- · 2019-06-18 11:25

No, probably not. Instead, you can use HTTPS basic authentication when you create the submodule in your git repository, similar to deploying private gems to Heroku. Looks something like this:

git submodule add https://username:password@github.com/username/repo.git
查看更多
爷、活的狠高调
4楼-- · 2019-06-18 11:36

There is another solution to @kanzure approach: https://stackoverflow.com/a/29464430/990356

Go to Settings > Personal access tokens and generate a personal access token with repo scope enabled.

Now you can do git clone https://MY_TOKEN@github.com/user-or-org/repo and in the case of a submodule git submodule add https://MY_TOKEN@github.com/user-or-org/repo

Pros:

  • very simple approach
  • token can be easily revoked
  • your real password is safe

Cons:

  • if someone has access to the token, he can access your GitHub repos (read and write)
查看更多
登录 后发表回答