Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Failed to push some refs when using push

I create a repository in Github and on my local machine I ran the code:

git init
git branch -m main
git remote add origin https://github.com/.../Project.git
git push -u origin main

Instead of using master branch I want to use main branch.

When running git push -u origin main I get the error:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

failed to push some refs to 'https://github.com/.../Project.git'

What am I doing wrong?

>Solution :

Is your local repo empty?

In this case, you need to add a file and commit it.

1. Run notepad test.txt (Windows) or touch test.txt (Mac)
2. Save the file.
3. git add . 
4. git commit -m "Initial commit"
5. git push -u origin main
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading