I may be missing something, but I'm sure that I've checked everything,
I forked a repo and cloned it on my system,
made some changes
after commiting
did git push origin master
it says
fatal: remote error:
You can't push to git://github.com/my_username/my_repo.git
Use [email protected]:my_username/my_repo.git
Am I missing something?
then I tried
git remote add origin https://github.com/my_username/my_repo.git
it returned
fatal: remote origin already exists.
I dont understand why this is hapenning, pls help
If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.
To fix this issue, run git pull on your local repository. This should allow you to push to origin again.
To push a branch on remote, your branch needs to have the latest changes present in remote repository. If you get the failed to push error, first do git pull the branch to get the latest commits and then push it.
The url with
git://github.com/my_username/my_repo.git
git:// Only gives read only access as mentioned in the side too..
Whereas,
[email protected]:my_username/my_repo.git
gives read and write access as mentioned in site
Though, https://github.com/my_username/my_repo.git
also has read and write access but it was not working in your case because you trying to create a new remote with the same name instead of resetting it. The correct syntax as mentioned was
git remote set-url origin [email protected]:my_username/my_repo.git
And
git remote set-url origin https://github.com/my_username/my_repo.git
would also work.
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