[Solve] Src Refspec Master Does Not Match Any When Pushing Commits in Git | Butuh Script

BUTUH SCRIPT

[Solve] Src Refspec Master Does Not Match Any When Pushing Commits in Git

When we start using git, we never know how to upload our repository in Git.  I do like someone who never operates git before. Click  +  on the right corner beside profile picture, then choose  New repository and I got this page. 


I fill it like usual. Fill repository name, description, choose Public because I want to share my project, and I click  create repository. There's no problem I think. Then I got this page. 


At the first time, I see this page. I don't know what is it, but I remember that i ever using git when the collaborative program in bitbucket. So, I tried like when I using bitbucket and I open my Linux terminal. Then select the directory for my git and tried to follow the instruction there. 



I got error  Initialized empty Git repository in /home/chalidade/Document/go/.git/  when following the instruction without clone repository first. So, I clone repository in git by using git clone https://github.com/chalidade/Golang.git  , you can see there. After cloning process done, I got a directory Golang then I do like the instruction on git pages. 

echo "# Golang" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/chalidade/Golang.git
git push -u origin master

But something went wrong when I tried using git push -u origin master. I got error  Src Refspec Master Does Not Match Any...  like this. 


I'm really confused how to fix it. Till I search on google and I got this page on stackoverflow. To fix this, it is very easy by using git commit -m 'initial commit'  then git push origin master and it's done. 


Conclusion : 

Maybe you just need to commit. I ran into this when I did:
mkdir repo && cd repo
git remote add origin /path/to/origin.git
git add .
Oops! Never committed!
git push -u origin master
error: src refspec master does not match any.
All I had to do was:
git commit -m 'initial commit'
git push origin master
Success!

Thanks for: baisong Stackoverflow user

1 komentar:

this is nice blog which you updated here with full info. please add more like this.

psd to drupal
what is golang
water delivery app

Reply

Posting Komentar