Home > Back-end >  Setting GITHUB_TOKEN within Docker Image still causes manual auth
Setting GITHUB_TOKEN within Docker Image still causes manual auth

Time:02-28

I have a docker image which I am trying to run some git commands in an automation script, I am using the Github CLI for this.

Just for testing locally I am manually setting the token from Github using Python like so:

import os
os.environ['GITHUB_TOKEN'] = token

I would expect this to allow me to run the following commands without asking me to login:

git clone project
cd project

But when I run the docker image it keeps asking me for my Username & Password to Github:

Cloning into 'project'...
Username for 'https://github.com':

Running gh auth status outputs:

github.com
  ✓ Logged in to github.com as yudhiesh (GITHUB_TOKEN)
  ✓ Git operations for github.com configured to use https protocol.
  ✓ Token: *******************

Which should mean I am authenticated but why is it asking me for my username and password again?

CodePudding user response:

The solution was to update the URL I cloned from to git clone https://[email protected]/user-or-org/repo.

  • Related