command: git push origin main doesn't work correctly #55626
Replies: 2 comments 1 reply
-
|
The In Git, the default branch name has evolved over time. Historically, the default branch was often named To resolve the issue, you have a few options: Rename the branch: If you want to use After renaming the branch, you should be able to use Use Configure default branch in GitHub: If you want to create new repositories with To change the default branch setting on GitHub, follow these steps: Go to the repository page on GitHub. To adjust your commands and workflows based on the default branch name you choose. |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for posting in the GitHub Community, @GitBodya ! We're happy you're here. You are more likely to get a useful response if you are posting your question in the applicable category, the Issues category is solely related to conversations around the GitHub products Issues and Projects. I've gone ahead and moved it for you. Good luck! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Bug
Select Feature Area
Body
I've created a repository with a default master branch.
After that I created a folder on my local machine.
In this folder, I started Git bash and initialized Git with the command: git init.
After that I saw a new .git folder created in my folder.
I then entered the following command which completed successfully:
git remote add origin https://github.com/GitBodya/electro.git
And when I tried to initialize: git push origin main
I got the error: error: src refspec main does not match any
error: Failed to send some links to 'https://github.com/GitBodya/electro.git'
But I ran the following command: git push -u origin master everything finished successfully.
And the next command: " git push origin master " works successfully, just like the previous command.
For example I created new Repository https://github.com/GitBodya/test with name test
I didn't add readmi file to repository and I saw that I had to use git push origin main instead git push -u origin master in documentation
Using this documentation I got error described above.
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions