I recently started using the GitHub CLI to manage multiple GitHub accounts on the same device. However, I've been unable to push code to a repository I was added to. I've checked, and the account I'm currently logged in as has the necessary permissions to make changes to the repo.
I did a couple of searches, and I found this https://github.com/cli/cli/issues/6740, which suggested the use of a Private Access Token (PAT) during the "log in to GitHub cli" process, which is very different from the flow I used.
Is there any reason I keep getting the repository not found error? Note I've pushed before after switching to GitHub CLI, and I didn't have any issues then (repositories I created). The one I'm having issues with currently is a private repo, of which I am a member with the highest privileges.
There are multiple ways to authenticate using the GitHub CLI, including SSH keys or HTTPS with a Personal Access Token (PAT). Authentication is required prior to cloning any repository, and typically, you only need to authenticate once.
If you encounter a "repository not found" error, it might indicate an issue with the permissions associated with your Personal Access Token. Ensure that your token has the necessary scopes enabled, as shown in the GitHub screenshot I’ve attached.
I’ve personally tested cloning a private repository using a properly configured Personal Access Token, and it worked without any issues.