0

I understand that similar topics have been posted on this site many times before. I read them and tried all the suggestions. Somehow, I still cannot successfully push the local code back to the "fork" in GitHub using Git Bash.

I "fork"ed a project, which is vlerdas-subscribe, in the GitHub by clicking the Fork button.

I cloned the fork into the current directory in my laptop using Git Bash (I gave my GitHub username while cloning)

I added some code to one of the project files.

I had problems when I used the command git push origin master while pushing the entire project to the "fork". Some nice person on this site told me that the current version of the Git bash has a bug -- (for https) it does not prompt for username and password. Therefore, I followed his advice and did the following; but I got "src refspec master does not match any. failed to push some refs to ..."

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'

I saw some suggestions to answer similar topics on this site; therefore, I tried those suggestions but nothing seems to work. I copied my command window below:

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)
$
user2886680
  • 61
  • 3
  • 9
  • You need to change into the directory that you cloned the repository into. You ran all those git commands in your home directory. Maybe it's in that workspace directory? – Paul Hicks Jan 28 '14 at 19:02
  • Possible duplicate of [src refspec master does not match any when pushing commits in git](http://stackoverflow.com/questions/4181861/src-refspec-master-does-not-match-any-when-pushing-commits-in-git) –  Jun 06 '14 at 04:40

1 Answers1

0

You've added the wrong origin.

Remove it and add the correct one:

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

where <your-username> should be replaced by your github username (eg. John).

Note that you also have to be in the root folder of the repository to do this.

Agis
  • 32,639
  • 3
  • 73
  • 81