DrupalPod
DrupalPod copied to clipboard
Cannot use user's git authentication inside ddev container
Describe the bug
When running git commands in Gitpod, Gitpod uses /usr/bin/gp credential-helper command to get authorization.
When running git commands inside ddev container, gp credential-helper is not available.
This issue becomes obvious when fetching github repo through composer inside ddev container (see steps to reproduce)
Or when git clone a private repo inside ddev container.
To Reproduce
- Open DrupalPod workspace in Gitpod
- Follow https://github.com/zolhorvath/cd_tools instructions:
- Type in terminal:
composer config repositories.'zolhorvath/cd_tools' github https://github.com/zolhorvath/cd_tools.gitcomposer require zolhorvath/cd_tools
You'll see the following error:
GitHub API limit (0 calls/hr) is exhausted, could not fetch https://api.github.com/repos/zolhorvath/cd_tools/contents/composer.json?ref=123456789012345678901234567890. Create a GitHub OAuth token to go over the API rate limit. You can also wait until ? for the rate limit to reset.
When working with _public_ GitHub repositories only, head to https://github.com/settings/tokens/new?scopes=&description=Composer+on+drupalpod-web+2022-04-29+0117 to retrieve a token.
This token will have read-only permission for public information only.
When you need to access _private_ GitHub repositories as well, go to https://github.com/settings/tokens/new?scopes=repo&description=Composer+on+drupalpod-web+2022-04-29+0117
Note that such tokens have broad read/write permissions on your behalf, even if not needed by Composer.
Tokens will be stored in plain text in "/home/gitpod/.composer/auth.json" for future use by Composer.
For additional information, check https://getcomposer.org/doc/articles/authentication-for-private-packages.md#github-oauth
Token (hidden):
Expected behavior
I'd like to run git commands in container with same access as I get in Gitpod. This will also block private repos.
Screenshots
Version and configuration information (please complete the following information)
- Issue page
- Issue branch
- Drupal core version
- Project type
- [ ] Core
- [ ] Module
- [ ] Theme
Additional context
~/.gitconfig includes:
[push]
default = simple
[credential]
helper = /usr/bin/gp credential-helper
This PR is trying to solve a similar issue - https://github.com/gitpod-io/gitpod/pull/8228