heroku + git submodule needs authentication

元气小坏坏 提交于 2020-01-03 09:45:03

问题


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


回答1:


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



回答2:


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.




回答3:


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)


来源:https://stackoverflow.com/questions/9400474/heroku-git-submodule-needs-authentication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!