Unable to submit successfully when pushing
error: src refspec master does not match any
error: failed to push some refs to 'https://gitee.com/xxxxxxx/cool-admin-midway.git'
The content of the question is:
Error: SRC refspec master does not match any
error: failed to push some references to ” https://gitee.com/xxxxxxx/cool-admin-midway.git ’
That is, the warehouse is empty
solution:
Use the git add XXX. Py
( git add.
add all) instruction to add all files, and then perform git commit – M “init” to commit all files,
git commit -m "init"
Then in execution
$ git remote add origin xxxxxxxx.git
Last use
$ git push -u origin master
In this way, the code can be uploaded successfully. You can see that the code is uploaded successfully in the warehouse
Summary:
In fact, you only need to do the following steps to upload local projects 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. Finally, push the project from the local repository to the remote repository (i.e. Github) via git push -u origin master; (if the README file is automatically created when you create a new remote repository, it will report an error, see above for the solution).
Complete steps for uploading files locally to gitee
Git global settings:
git config --global user.name "namexxxx"
git config --global user.email "emailxxx"
Create a git repository:
mkdir test_code
cd test_code
git init
git add xxxx (to add files, git add . Add all)
git commit -m "first commit"
git remote add origin https://xxxxx.git
git push -u origin master