0

I am new to github and trying to create my first repository. After executing the below command:

$ git push -u origin master

I am getting following error:

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/rs/python-gtts.git

Few things I did,

Created a folder in my local: /Users/TrainingLearning/github/Python

After that executed following command:

echo "# python-gtts" >> README.md
git init
git add README.md

Then added my code (Python file - TextToSpeech.py) to the same folder where I earlier created README.md file: /Users/TrainingLearning/github/Python

And tried doing:

$ git add .
$ git commit -m "first commit"
$ git remote add origin https://github.com/rs/python-gtts.git

But when I execute following command:

$ git push -u origin master

I started getting following error:

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/rs/python-gtts.git'
chuckx
  • 6,484
  • 1
  • 22
  • 23
Rajat
  • 19
  • 1
  • 1
  • 6
  • Possible duplicate of [src refspec master does not match any when pushing commits in git](https://stackoverflow.com/questions/4181861/src-refspec-master-does-not-match-any-when-pushing-commits-in-git) – phd Jun 09 '18 at 18:07
  • what is the output of `git branch | grep master`? – Timothy Truckle Jun 09 '18 at 19:50
  • Nothing it just moves to the next line – Rajat Jun 09 '18 at 22:09
  • Another thing when I execute following command $ git commit -m "first commit" *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" So I run git config --global xxxx.xxxxxx@gmail.com but still I am not able to push my code – Rajat Jun 09 '18 at 22:13

1 Answers1

0

I found the problem, my git was not properly configured, so I had to run following commands:

$ git config --global user.email "xxxx.xxxx@xxxxx.com" $ git config --global user.name "xxxx"

After this I was successfully able to push my code into git by running following commands:

$ git commit -m "Initial Commit" $ git push -u origin master

Rajat
  • 19
  • 1
  • 1
  • 6