In GitHub, by mistake, I created a repository https://github.com/myidmyrepo.git (incorrect instead of) https://github.com/myid/myrepo.git (correct).
- I do not see the incorrect repo in GitHub, so I cannot delete it.
- Now, I created https://github.com/myid/myrepo.git (correct) but git push --set-upstream origin master remote: Not Found fatal: repository 'https://github.com/myidmyrepo.git/' not found
git push -u origin master error: src refspec maste does not match any error: failed to push some refs to 'https://github.com/myidmyrepo.git'
Please, help.
CodePudding user response:
You need to use the following command:
git remote set-url origin "https://github.com/myid/myrepo.git"
This command changes the remote origin URL to the correct one. Then, you can push your work normally.
CodePudding user response:
You've described two different error messages, and the differences between them are important:
git push --set-upstream origin master remote: Not Found fatal: repository 'https://github.com/myidmyrepo.git/' not found
This error is due to having the wrong URL stored under the name origin
.
To fix that, use git remote set-url origin
as shown in Moemen's answer, or use git config --edit
to edit .git/config
in your favorite text editor—make sure it's one that won't damage a Git configuration—to correct the URL stored under the remote name origin
.
git push -u origin master error: src refspec master does not match any error: failed to push some refs to 'https://github.com/myidmyrepo.git'
This error is different (though it still has the wrong URL) as it says src refspec master does not match any
. This is a duplicate of many previous questions, including Message 'src refspec master does not match any' when pushing commits in Git. The message itself simply means that you have nothing named master
, either because you're using some other branch name, or because you have no commits yet, or both.