git push origin to private Github repo

Manuel's Avatar

Manuel

06 Mar, 2020 07:17 PM

Hi,

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)
>>
  on_success:
    - git remote set-url origin https://github.com/%APPVEYOR_REPO_NAME%
    - git config --global credential.helper store
    - ps: Add-Content "$HOME\.git-credentials" "https://$($env:GITHUB_TOKEN):x-oauth-basic@github.com`n"
    - git config --global user.email "manuel.<xxxx>@<yyyy>.com"
    - git config --global user.name "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 https://github.com/%APPVEYOR_REPO_NAME%
git config --global credential.helper store
Add-Content "$HOME\.git-credentials" "https://$($env:GITHUB_TOKEN):x-oauth-basic@github.com`n"
git config --global user.email "manuel.<xxxx>@<yyyy>.com"
git config --global user.name "Manuel XXXX"
git tag "%GitVersion_NuGetVersion%" %APPVEYOR_REPO_COMMIT%
git push origin "%GitVersion_NuGetVersion%"
remote: Repository not found.
fatal: repository 'https://github.com/multimedia-press/<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.

Manuel

  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.

    Manuel

    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.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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