DrupalPod icon indicating copy to clipboard operation
DrupalPod copied to clipboard

Cannot use user's git authentication inside ddev container

Open shaal opened this issue 3 years ago • 0 comments

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

  1. Open DrupalPod workspace in Gitpod
  2. Follow https://github.com/zolhorvath/cd_tools instructions:
    1. Type in terminal:
    2. composer config repositories.'zolhorvath/cd_tools' github https://github.com/zolhorvath/cd_tools.git
    3. composer 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

shaal avatar Apr 29 '22 01:04 shaal