Linux alternative to .git-credentials

oliver's Avatar


19 Mar, 2018 10:59 AM


I am using this line to authenticate with the github repository (so that I can push changes):

- ps: Add-Content "$env:USERPROFILE.git-credentials" "https://$($env:access_token)`n"

This fails on the ubuntu image with:

Add-Content : Access to the path '/.git-credentials' is denied.

Do you have a suggestion how I could do this differently?


  1. 1 Posted by oliver on 20 Mar, 2018 06:16 PM

    oliver's Avatar


  2. Support Staff 2 Posted by Wasa Pleshakov on 20 Mar, 2018 09:32 PM

    Wasa Pleshakov's Avatar

    There is no USERPROFILE variable in ubuntu that is why it tries to write file in the root of FS. Please use Home variable instead which is set both in linux and windows (Note, it does not have trailing slash). I suggest to use Join-Path for multiplatform scripts when you need to construct path to file:

    Join-Path $Home ".git-credentials"

    In ubuntu image you have to configure git to use .git-credentials file as credential Storage:

    git config --global credential.helper "store --file ~/.git-credentials"
    For Git Credential Storage please read

    Also you may get access to your github repos by ssh:

  3. 3 Posted by oliver on 21 Mar, 2018 02:42 PM

    oliver's Avatar

    yeap.. that did it..
    I should have noticed that. sorry.

    about the ssh: how would I deploy the certificates to the CI without making them available in the public repo?

  4. Support Staff 4 Posted by Wasa Pleshakov on 21 Mar, 2018 08:14 PM

    Wasa Pleshakov's Avatar

    Do you mean private keys for ssh?
    Any way you can store sensitive data encrypted in Secure Variables ( and echo that data to files you need during install, build or test phase.

  5. 5 Posted by oliver on 21 Mar, 2018 10:54 PM

    oliver's Avatar

    ok... I guess there is something I didn't understand yet.
    Because I was under the impression the private key would be a file

  6. 6 Posted by Ilya Finkelshte... on 21 Mar, 2018 11:04 PM

    Ilya Finkelshteyn's Avatar

    Here is Windows sample. Do you believe you can adapt it for Linux? And of yes, can you share how you made it work?

    Meanwhile I filed this issue but Base64 approach should work well too.

  7. Ilya Finkelshteyn closed this discussion on 25 Aug, 2018 02:27 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac