2hwbjw
Last Updated: June 18, 2017
·
3.282K
· petrbela
D1d8b6e6a25f6fa7bc5f89bc33aa3422

Deploying private submodules on heroku

If you use private git submodules in your github project, you'll have a problem deploying it to heroku (or anywhere else). Since private git repos are not accessible without authentication, you'll need to add that to the repo URL.
Suppose your .gitmodules has a dependency to myModule (and your github username is me):
[submodule "myModule"] path = lib/myModule url = https://github.com/me/myModule.git
One way to add authentication is to add your github username/password to the URL: https://username:password@github.com/me/myModule.git.

However, having your password in a plain-text file isn't the best way to hide it from others. With github you can easily create an oauth token to use instead, as documented here.

Just run:
curl -XPOST https://api.github.com/authorizations -u me -d '{"scopes":["repo"]}'

Then provide your github password and you'll receive a token that you can use to access any of your private repositories.

Now just change the url in .gitmodules to https://<received-oauth-token>:x-oauth-basic@github.com/me/myModule.git (the x-oauth-basic password is optional; you can skip it altogether).

Say Thanks
Respond

4 Responses
Add your response

12516
Rai

I had to use:

url = https://<token>:x-oauth-basic@github.com/user/repo.git
over 1 year ago ·
13243
D1d8b6e6a25f6fa7bc5f89bc33aa3422

Hm, I'm wondering how x-basic-auth got there. It's x-oauth-basic of course. Thanks for the correction!

over 1 year ago ·
13571
Dea87749ef370cc8222b548426e74bbb

I had to use an additional parameter on calling authorizations method:

curl -XPOST https://api.github.com/authorizations -u me -d '{"scopes":["repo"], "note": "MyDescription"}

Hope it helps!

over 1 year ago ·
29042

I don't what is the difference between storing your password or x-oauth-basic in repository.

6 months ago ·