So I'm trying to pull a branch from one of my private repositories into GitHub Actions, so I can modify it and push it back into that repository, but it won't let me. Although I can clone the repo, but since I need to push modified files back into the repository, that won't work. The workflow that I ran the commands on, runs on ubuntu-latest
. Another thing to note is that when I ran these same commands on my Windows computer, everything runs properly, but for some reason, I didn't need the token or username for the link to work. When I try to pull from the remote repo, I get the following error.
remote: Repository not found.
fatal: repository 'https://github.com/[username]/[repo].git/' not found
Error: Process completed with exit code 1.
But when I try to clone the repository, the command successfully runs. The commands I ran are below.
I create the remote repo with
git remote add repo https://[username]:[token]@github.com/[username]/[repo].git
The token has the repo
scope, so it has complete access to repositories. To verify that the command worked, I ran
git remote -v
Which shows the new remote that I added so I know it worked. Next I try to pull the master
branch from the remote repo with
git pull repo master --allow-unrelated-histories
Which is where I get the error. The clone command is
git clone https://[username]:[token]@github.com/[username]/[repo].git
This command runs successfully unlike the git pull
command.
I have looked at Git - remote: Repository not found and Git Clone - Repository not found, but none of the answers I've tried helped me. Since the commands worked on my local computer, it most likely isn't the commands, and is probably something to do with how GitHub Actions runs the commands or the token.
repo
scope.https://[username]:[token]@github.com/[username]/[private repo].git
git remote add repo ${{ secrets.[secret name] }}
, git remote -v # To verify that the remote add worked
, git pull repo [main/master branch]
, and ls
I fixed my problem by setting the .git/config
file to what my local .git/config
file was, and that solved the problem. I don't know what part of the config file was causing the error, but I do know there was a problem with it.