我是github的新手,正在尝试创建我的第一个存储库。执行以下命令后:
$ git push -u origin master
我收到以下错误:
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/rs/python-gtts.git
我做了几件事
在我的本地创建了一个文件夹: /Users/TrainingLearning/github/Python
之后,执行以下命令:
echo "# python-gtts" >> README.md
git init
git add README.md
然后将我的代码(Python文件- TextToSpeech.py
)添加到我之前创建README.md文件的同一文件夹中:/Users/TrainingLearning/github/Python
并尝试做:
$ git add .
$ git commit -m "first commit"
$ git remote add origin https://github.com/rs/python-gtts.git
但是当我执行以下命令时:
$ git push -u origin master
我开始出现以下错误:
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/rs/python-gtts.git'
我发现了问题,我的git没有正确配置,所以我必须运行以下命令:
$ git config --global user.email“ [email protected]” $ git config --global user.name“ xxxx”
之后,我可以通过运行以下命令将代码成功推送到git中:
$ git commit -m“初始提交” $ git push -u原始主机
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句