error: src refspec master does not match any [How to Solve]

When you use the git bash command to upload items to github, you always encounter some errors that cannot be resolved.

Here is a problem I encountered

error: src refspec master does not match any.
error: failed to push some refs to '[email protected]:hahaha/ftpmanage.git'

Question content:

Error: SRC ReFSPEC master does not match any
Error: Failed to push some references to ‘git @ Github. com: HaHaa/ftpMal git’

That is, the warehouse is empty.

Solution:

Use git add xxx.py command adds all files, and then use command git commit -m “init” to commit all files,

git commit -m "init"

Then execute

git remote add origin xxxxxxxx.git

Last use

$ git push -u origin master

be accomplished.

Summary:

In fact, only the following steps are needed to upload the local project to Github

 1. create a local repository (i.e. folder) and turn it into a Git repository by git init.

 2. Copy the project into this folder and add it to the repository via git add . Add the project to the repository.

 3. commit the project to the repository by using git commit -m "comment content".

 4, after setting up the SSH key on Github, create a new remote repository by git remote add origin https://github.com/guyibang/TEST2.git Associate a local repository with a remote repository.

 5, and finally push the local repository project to the remote repository (that is, Github) through git push -u origin master; (if the new remote repository automatically created a README file will report an error, the solution see above).

 

Read More: