[Solved-5 Solutions] src refspec master does not match any when pushing commits in git - git
Error Description:
- It happens when we try to checkout/clone the new repository from local machine
- It causes an error
Solution 1:
You've created a new repository and added some files to the index, However you haven't created your first commit yet:
We do that,
Solution 2:
- The origin has no master branch,when you clone an empty git repository, So the first time you have a commit to push:
- It will create a new master branch for you.
- If this didn't fix your issue then it is an gitolite-related issue:
- An example conf file that came with your gitolite. It looks like below code:
- Make sure you're setting your conf file correctly.
- Gitolite actually replaces the gitolite user's account with a modified shell that doesn't accept interactive terminal sessions. You can see if gitolite is working by trying to ssh into your box using the gitolite user account.
- Whether it knows who you are it will say something like "Hi XYZ, you have access to the following repositories: X, Y, Z" and then close the connection. If it doesn't know you, it will close the connection.
- Finally, after your first git push failed on your local machine you should never resort to creating the repo manually on the server.First we need to know why your git push failed .There will be more confusion when you don't use gitolite exclusively.
Solution 3:
- While adding an empty directory. Git doesn't allow to push empty directory. Here is a simple solution. Create the file .gitkeep inside of directory you want to push to remote and commit the "empty" directory from the command line: