tag:help.appveyor.com,2012-11-13:/discussions/problems/32091-accessing-another-repo-during-buildAppVeyor: Discussion 2022-07-13T21:02:07Ztag:help.appveyor.com,2012-11-13:Comment/542280322022-05-11T03:06:52Z2022-05-11T03:06:52ZAccessing another repo during build<div><p>This guide is more cool: <a href="https://www.appveyor.com/docs/how-to/git-push/">https://www.appveyor.com/docs/how-to/git-push/</a></p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/542280322022-05-11T20:47:28Z2022-05-11T20:47:30ZAccessing another repo during build<div><p>I did this, but it still didn't work. Instead of giving a failed authentication error like before, it just hung (must be waiting for credentials). Also I had to change directories and init since I'm changing repos.</p>
<p>environment:<br>
access_token: secure: svD9dHltYqXJZJFxS8q9W86QjQ7TLAaKLqXOjAVzwJ+v1lQ8mz8fK3dI6Te6OOGF</p>
<p>on_success:<br>
- cmd: cd ../ && mkdir BAC && cd BAC - git init - git config --global credential.helper store - ps: Set-Content -Path "$HOME.git-credentials" -Value "https://$($env:access_token):<a href="mailto:x-oauth-basic@github.com">x-oauth-basic@github.com</a>`n" -NoNewline - git config --global user.name "csalmon1" - git config --global user.email "<a href="mailto:csalmon@oceanit.com">csalmon@oceanit.com</a>" - git pull <a href="https://github.com/csalmon1/BAC.git">https://github.com/csalmon1/BAC.git</a> - cmd: pwd && dir</p></div>Colby Salmontag:help.appveyor.com,2012-11-13:Comment/542280322022-05-11T21:38:38Z2022-05-11T21:38:38ZAccessing another repo during build<div><p>Make sure you are not testing it in PR build as secure variables are not set in PR builds.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/542280322022-05-11T22:37:53Z2022-05-11T22:37:59ZAccessing another repo during build<div><p>I don't think it's a PR build. How do I check and make sure? If so, how do I change it?</p>
<p>The first repo accessed for the build is a public github repo. The second repo I am trying to access to push the build artifacts is a private github repo.</p></div>Colby Salmontag:help.appveyor.com,2012-11-13:Comment/542280322022-05-11T22:40:15Z2022-05-11T22:40:21ZAccessing another repo during build<div><p>I am the owner of both repos.</p></div>Colby Salmontag:help.appveyor.com,2012-11-13:Comment/542280322022-05-11T22:54:10Z2022-05-11T22:54:10ZAccessing another repo during build<div><p>Well, it's hard to tell what's wrong with your code - it looks OK to me. Try connecting to a build VM via <a href="https://www.appveyor.com/docs/how-to/rdp-to-build-worker/">RDP</a> and experiment from there.</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/542280322022-05-12T01:17:30Z2022-05-12T01:17:34ZAccessing another repo during build<div><p>It seems to work when I push back to the same repo I started with, but it doesn't work to switch and pull or clone from a different repo.</p></div>Colby Salmontag:help.appveyor.com,2012-11-13:Comment/542280322022-05-12T02:19:46Z2022-05-12T02:19:46ZAccessing another repo during build<div><p>Perhaps you should add/update remote?</p></div>Feodor Fitsnertag:help.appveyor.com,2012-11-13:Comment/542280322022-05-12T23:10:44Z2022-05-12T23:10:50ZAccessing another repo during build<div><p>Here is some console output that shows I have successfully configured the repo and set the remote url:</p>
<p>cd ../../ && pwd && mkdir BAC && cd BAC<br>
/c/projects git init .<br>
Initialized empty Git repository in /c/projects/BAC/.git/<br>
git status<br>
On branch master<br>
No commits yet<br>
nothing to commit (create/copy files and use "git add" to track)<br>
git remote add origin <a href="https://github.com/csalmon1/BAC.git">https://github.com/csalmon1/BAC.git</a><br>
git remote -v<br>
origin <a href="https://github.com/csalmon1/BAC.git">https://github.com/csalmon1/BAC.git</a> (fetch)<br>
origin <a href="https://github.com/csalmon1/BAC.git">https://github.com/csalmon1/BAC.git</a> (push)<br>
git config --global credential.helper store<br>
Set-Content -Path "$HOME.git-credentials" -Value "https://$($env:access_token):<a href="mailto:x-oauth-basic@github.com">x-oauth-basic@github.com</a>`n" -NoNewline<br>
git config --global user.name "csalmon1"<br>
git config --global user.email "<a href="mailto:xxx@xxx.com">xxx@xxx.com</a>"<br>
git fetch https://$($env:access_token):<a href="mailto:x-oauth-basic@github.com">x-oauth-basic@github.com</a>/csalmon1/BAC.git main<br>
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.<br>
remote: Please see <a href="https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/">https://github.blog/2020-12-15-token-authentication-requirements-fo...</a> for more information.<br>
fatal: Authentication failed for '<a href="https://github.com/csalmon1/BAC.git/">https://github.com/csalmon1/BAC.git/</a>'<br>
Command exited with code 128</p>
<p>When I did fetch command with no arguments, it hung and waited for credentials. When using fetch with arguments and token it fails to authenticate and tells me to use a token.</p></div>Colby Salmontag:help.appveyor.com,2012-11-13:Comment/542280322022-05-12T23:47:27Z2022-05-12T23:47:27ZAccessing another repo during build<div><p>When you put credentials to <code>.git-credentials</code> I don't think you need to put them again in git fetch URL. Try just:</p>
<pre>
<code>git fetch https://github.com/csalmon1/BAC.git main</code>
</pre></div>Feodor Fitsner