我对git的了解很少,所以我试图在github上创建一个项目以获取一些练习。
我已经在网站上创建了一个空存储库,遵循此官方指南
然后,如建议:
echo "# test" >> README.md
git init
git add README.md
git commit -m "first commit"
我还配置了此存储库的邮件和名称,并继续该指南:
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git remote add origin https://github.com/saatomic/test.git
git push -u origin master
我尝试什么似乎并不重要,当我尝试推动本地数据时,我总是会得到以下内容:
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/saatomic/test.git'
我已经迷路了 - 我严格遵循了Github的支撑指南。
我在做什么错,如何正确推出本地数据?
编辑:
$ git remote -v
origin https://github.com/saatomic/test.git (fetch)
origin https://github.com/saatomic/test.git (push)
更新:我能够在不同的Linux VM上做完全相同的操作,其中一切都按预期成功。这似乎是我本地系统的问题。我无法理解为什么(更新了Ubuntu 17.04),Git版本2.11.0。
更新#2:我在Ubuntu 16.04.3 LTS上重述了相同的git版本2.7.4,同一问题。
更新3:不是此问题的重复。我在那里尝试了所有建议,我应该提到。
我尝试添加,提交和更改分支,如建议。推动仍然没有相同的错误消息失败。
error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/saatomic/test.git'
也建议(两者完全没有报告):
$ git show-ref
$
$ git branch
$
力推动也不起作用,我确实有一个未决的提交:
$ git status
On branch master
Initial commit
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: README.md
解决:问题是,我必须配置邮件和用户名和,然后进行新的提交。
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git commit -m "post-conf commit"
问题是,我必须配置邮件和用户名和,然后进行新的提交。
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
git commit -m "post-conf commit"