error: src refspec master does not match any

后端 未结 21 1106
别跟我提以往
别跟我提以往 2020-12-22 17:38

I have tried to follow the solutions suggested in this post but it didnt work and I am still getting: src refspec master does not match any.

Here is what I did: Fo

相关标签:
21条回答
  • 2020-12-22 18:23

    Setup username and password in the git config

    In terminal, type

    vi .git/config
    

    edit url with

    url = https://username:password@github.com/username/repo.git
    

    type :wq to save

    0 讨论(0)
  • 2020-12-22 18:24

    I was having the SAME ERROR AGAIN AND AGAIN.

    I added files in local repository and Trying the command

    "git push origin master"

    Showed Same Error

    ALL I WAS MISSING I DID NOT COMMIT .

    " git commit -m 'message' "

    After Runnig this it worked

    0 讨论(0)
  • 2020-12-22 18:28

    The error demo:

    007@WIN10-711082301 MINGW64 /d/1 (dev)
    $ git add --all
    
    007@WIN10-711082301 MINGW64 /d/1 (dev)
    $ git status
    On branch dev
    Initial commit
    Changes to be committed:
      (use "git rm --cached <file>..." to unstage)
    
        new file:   index.html
        new file:   photo.jpg
        new file:   style.css
    
    007@WIN10-711082301 MINGW64 /d/1 (dev)
    $ git push origin dev
    error: src refspec dev does not match any.
    error: failed to push some refs to 'git@github.com:yourRepo.git'
    

    You maybe not to do $ git commit -m "discription".

    Solution:

    007@WIN10-711082301 MINGW64 /d/1 (dev)
    $ git commit -m "discription"
    [dev (root-commit) 0950617] discription
     3 files changed, 148 insertions(+)
     create mode 100644 index.html
     create mode 100644 photo.jpg
     create mode 100644 style.css
    
    007@WIN10-711082301 MINGW64 /d/1 (dev)
    $ git push origin dev
    To git@github.com:Tom007Cheung/Rookie-s-Resume.git
     ! [rejected]        dev -> dev (fetch first)
    error: failed to push some refs to 'git@github.com:yourRepo.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    
    0 讨论(0)
提交回复
热议问题