Oliver Bock
Oliver Bock

Reputation: 5115

Error when pushing to github repository cloned using a token

I have a script that installs new VMs using code cloned from a private github repository using a read-only access token like this:

git clone https://[email protected]/<organization>/<project>

I can commit changes to this code, but when I try to push I get this error:

remote: Repository not found.
fatal: repository 'https://[email protected]/<organization>/<project>/' not found

How can I commit without upgrading the token to have write access to the repository?

Upvotes: 1

Views: 49

Answers (1)

Oliver Bock
Oliver Bock

Reputation: 5115

You need to change the URL of the repository used for push operations only:

git remote set-url --push origin https://github.com/<organization>/<project>/

Then if you push you will be prompted for a github login and password, but fetch operations will continue to work without authentication.

Upvotes: 1

Related Questions