I was given access to a private repo shared for 5 people. I did a
git clone https://github.com/thecompany/theprogram.git
Then I made a new branch and tried to push it using the following:
git push --set-upstream the-new-branch
But I'm getting an error:
remote: Repository not found.
fatal: repository 'https://github.com/thecompany/theprogram.git/' not found
How can I push my branch onto github?
Expectation is to be able to push to a private repo that I am able to clone, but unable to push a branch too.
It depends on what "unable to push a branch to" means.
If it is "repository not found" as in the original question, that means the credentials (potentially cached) used to authenticate when pushing are incorrect.
Test first if a git ls-remote https://<you>@github.com/<user-or-org>/<private-repo>
works.
If it is a "permission denied" issue, the permission level might not be high enough (Ie: "read" or "triage" would allow a clone, not a push)
The OP confirms in the comments: he had only read access.
when you clone successfully, try this
first, checkout a new branch:
git checkout -b the-new-branch
then, push to remote origin(default):
git push origin the-new-branch
and, set upstream:
git branch --set-upstream-to=origin/the-new-branch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With