git push origin to private Github repo

Manuel's Avatar


06 Mar, 2020 07:17 PM


At the end of my jobs, I have the following commands to push the GitVersion generated version tag to my remote private repo on Github:
(excerpt from YML config file)
    - git remote set-url origin
    - git config --global credential.helper store
    - ps: Add-Content "$HOME\.git-credentials" "https://$($env:GITHUB_TOKEN)`n"
    - git config --global "manuel.<xxxx>@<yyyy>.com"
    - git config --global "Manuel XXXX"
    - git tag "%GitVersion_NuGetVersion%" %APPVEYOR_REPO_COMMIT%
    - git push origin "%GitVersion_NuGetVersion%"
It used to work seamlessly (a few month ago, I'm not a frequent user) but on my latest builds, I get an error :
git remote set-url origin
git config --global credential.helper store
Add-Content "$HOME\.git-credentials" "https://$($env:GITHUB_TOKEN)`n"
git config --global "manuel.<xxxx>@<yyyy>.com"
git config --global "Manuel XXXX"
git tag "%GitVersion_NuGetVersion%" %APPVEYOR_REPO_COMMIT%
git push origin "%GitVersion_NuGetVersion%"
remote: Repository not found.
fatal: repository '<private-repo-name>/' not found
Command exited with code 128
The private repo exists (the https link works).
I tried to generate a new Github token but no luck.

Any idea why this could fail?

Best regards.


  1. Support Staff 1 Posted by Feodor Fitsner on 09 Mar, 2020 11:35 PM

    Feodor Fitsner's Avatar

    Hi Manuel,

    I assume the token was configured as a secure variable (it should be if not). If so, and you are doing the test in Pull Request then secured variables are not set in PR builds. Could it be the case?

  2. 2 Posted by Manuel Ornato on 10 Mar, 2020 12:25 AM

    Manuel Ornato's Avatar

    Hi Feodor,
    Thanks for your answer.
    Yes the token is stored as a secure variable and no this is not a PR build.
    I pull the code at the start from the same repo I try to push the tag to at the end.
    The very same build was working a few month ago so I first suspected some change on the GitHub side. But I can't find anything.

    I generated a new GitHub token en encrypted it from my Appveyor account just to be sure, but I still get the same error.


    Le 10 mars 2020 00:35, Feodor Fitsner <[email blocked]> a écrit :

  3. Support Staff 3 Posted by Feodor Fitsner on 10 Mar, 2020 12:28 AM

    Feodor Fitsner's Avatar

    Try connecting to build VM via RDP and experiment in command line - could be easier to troubleshoot.

  4. Feodor Fitsner closed this discussion on 10 May, 2020 09:02 PM.

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