Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git-checkout lacks any authentication paramaters #1112

Open
andy-welsh-dwp opened this issue Mar 27, 2024 · 1 comment
Open

git-checkout lacks any authentication paramaters #1112

andy-welsh-dwp opened this issue Mar 27, 2024 · 1 comment

Comments

@andy-welsh-dwp
Copy link

The git-checkout pipeline does not appear to have any paramaters or obvious ways to authenticate against a private repository.

Typically the easiest way to get authentication in to a clone or checkout is by manipulating the git URI, I.E.:

git clone https://$username:$password@gitlab.com/privaterepo

Doing this in a secure system needs some kind of way to inject a secret. Currently I am able to inject an environment variable containing such a secret, however when running:

- uses: git-checkout
  with:
    repository: https://myuser:${GIT_SECRET}@gitlab.com/privaterepo
    branch: somebranch
    destination: privaterepo

$GIT_SECRET does not appear to be evaluated and authentication fails as if it weren't there.

As a workaround currently, I can use:

- runs: |
    git clone https://myuser:${GIT_SECRET}@gitlab.com/privaterepo -b somebranch

Thanks!

@xnox
Copy link
Contributor

xnox commented May 1, 2024

I wonder if it is better to allow injecting a ".gitcookies" file and configuring http to use cookies - which is slightly better than static passwors / netrc, as it is pre-authenticated cookie (which can be easily rotated/expired/logedout etc).

I.e. https://groups.google.com/a/chromium.org/g/chromium-os-discuss/c/MX1C8kHaNXo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants