I've recently cloned a repo to my local drive, but now I'm trying to push all changes to a complete new repo. However, git keeps telling me that permission is denied, and that's because it's trying to push to the originally-cloned repo.
DETAILS:
I originally cloned from https://github.com/taylonr/intro-to-protractor (i.e. based on a Pluralsight course at https://app.pluralsight.com/library/courses/protractor-introduction/table-of-contents ) .
Now that I've completed the course, I'd like to push my finalized code up to my own git repo (which I just created on github):
https://github.com/robertmazzo/intro-to-protractor
When I use the following git command:
git remote add origin https://github.com/robertmazzo/intro-to-protractor.git
it tells me remote origin already exists
, which I guess is fine because I already created it on github.com.
However, when I push my changes up I'm getting an exception.
git push origin master
remote: Permission to taylonr/intro-to-protractor.git denied to robertmazzo.
fatal: unable to access 'https://github.com/taylonr/intro-to-protractor.git/':
The requested URL returned error: 403
So I'm investigating how I can switch to my new repository, but this is exactly where my issue is. I cannot figure this part out.
Before you can add a new remote named "origin", you need to either delete the old one, or simply rename it if you still need access to it for some reason.
# Pick one
git remote remove origin # delete it, or ...
git remote rename origin old-origin # ... rename it
# Now you can add the new one
git remote add origin https://github.com/robertmazzo/intro-to-protractor.git
To change your current origin to a new one, use:
git remote set-url origin <url>
Source: https://help.github.com/articles/changing-a-remote-s-url/
origin is only an alias to identify your remote repository.
You can create a new remote reference and push
git remote add new_origin https://github.com/robertmazzo/intro-to-protractor.git
git push new_origin master
If you want to remove the previous reference
git remote remove origin
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