推送到“fork”Git Error - src refspec master与any匹配。未能将一些引用推到'https://

时间:2014-01-28 18:57:49

标签: git bash github

据我所知,此网站上已多次发布类似主题。我读了他们并尝试了所有的建议。不知怎的,我仍然无法使用Git Bash成功地将本地代码推回到GitHub中的“fork”。

通过单击Fork按钮,我在GitHub中“挖掘”了一个项目,即vlerdas-subscribe。

我使用Git Bash克隆了我的笔记本电脑中的当前目录(克隆时我给了我的GitHub用户名)

我在其中一个项目文件中添加了一些代码。

当我将整个项目推送到“fork”时使用命令 git push origin master 时出现问题。这个网站上的一些好人告诉我,当前版本的Git bash有一个错误 - (对于https)它不会提示输入用户名和密码。因此,我遵循他的建议并做了以下事情;但是我得到了“ src refspec master与任何一个都没有匹配。未能推出一些参考...

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git remote rm origin

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git remote add origin https://{username}:{password}@github.com/{username}/vlerdas-subscribe.git

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git push origin master
error: src refspec master does not match any.
error: failed to push some refs to 'https://{username}:{password}@github.com/{username}/vlerdas-    subscribe.git'

我在网站上看到了一些回答类似主题的建议;因此,我尝试了这些建议,但似乎没有任何效果。我复制了下面的命令窗口:

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git branch

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git show-ref

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git commit -m "Initial commit."

On branch master
Initial commit

Untracked files:
    .bash_history
    .dbshell
    .eclipse/
    .editix/
    .m2/
    .mongorc.js
    .org.eclipse.epp.usagedata.recording.userId
    .ssh/
    .sysdb20/
    AppData/
    Contacts/
    Desktop/
    Documents/
    Downloads/
    Favorites/
    Links/
    Music/
    NTUSER.DAT
    NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TM.blf
    NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000001.regtrans-ms
    NTUSER.DAT{016888bd-6c6f-11de-8d1d-001e0bcde3ec}.TMContainer00000000000000000002.regtrans-ms
    Oracle/
    Pictures/
    Saved Games/
    Searches/
    Tracing/
    Videos/
    Virtual Machines/
    client.cfg
    default-soapui-workspace.xml
    nodejs_test/
    ntuser.dat.LOG1
    ntuser.dat.LOG2
    ntuser.ini
    ntuser.pol
    soapUI-Tutorials/
    soapui-settings.xml
    vlerdas-subscribe/
    workspace/

nothing added to commit but untracked files present

vhaiswjenlim@VACOLTJENLIM ~ (master)
$ git push origin master

error: src refspec master does not match any.
error: failed to push some refs to 'https://{username}:{password}@github.com/{username}/vlerdas-    subscribe.git'

vhaiswjenlim@VACOLTJENLIM ~ (master)
$

1 个答案:

答案 0 :(得分:0)

你添加了错误的来源。

删除它并添加正确的:

$ git remote rm origin
$ git remote add origin https://github.com/<your-username>/vlerdas-subscribe.git

其中<your-username>应替换为您的github用户名(例如John)。

请注意,您还必须位于存储库的根文件夹中才能执行此操作。