I am using Git Bash on Windows 10. I have cloned a repository to my PC, added files to it and made commits.
When I try the command:
git push origin master
I get this error:
fatal: couldn't find remote ref master
But if I try a simple git push, there is no error and the changes are reflected in my remote repo.
The same is true with the pull command. What's going wrong and how do I fix this?
Edit: Based on the comments and the answers, I am adding this info.
When I do a git branch -avv I get the following output:
* main f42878d [origin/main] Added some more Week 1 problems
remotes/origin/HEAD -> origin/main
remotes/origin/main f42878d Added some more Week 1 problems
So, I tried what one of the answers suggested, which is to try git push origin main instead of git push origin master. This is my output:
warning: setting remote service path not supported by protocol
Logon failed, use ctrl+c to cancel basic credential prompt.
warning: setting remote service path not supported by protocol
Everything up-to-date
It does seem to work, but there are warnings before that. I googled the warning and found this Stackoverflow answer. Based on the accepted answer, I ran GitBash as administrator, but the warning persists. What happens is that the authentication happens twice: once normally through a GitHub Login dialog box where I put my username and password. This fails, then an OpenSSH dialog box where I provide my username and password. This works.
I am new to Git Bash, so I have no idea where to go from here.
git branch -avv?git push(i.e. the correct tracking branch is set), it's a problem that you can'tgit push <remote> <branch>).