This post has the solutions to error src refspec master does not match any, and error: failed to push some refs to.
The tips I share here are the exact solutions I used to overcome the errors.
Here you go…
error src refspec master does not match any
Working on your project and storing it on your local drive isn’t a problem, however, adding storing the project to an online server requires an additional repo URL.
git remote add origin <MY-URL>
We push it like this:
git push -u origin master
But it doesn’t always work. The following error is what comes out…
error: src refspec master does not match any. error: failed to push some refs to '<MY-URL>'
When pushing a new repository to Bitbucket Server, the following error is returned from the Git client:
git push -u origin master error: src refspec master does not match any. error: failed to push some refs to 'http://stash.company.com/scm/PROJECT/REPO.git'
The repo is empty and it is the cause of the problem. You don’t have any commits in the repo and you need a master to give the server.
Create the first commit inside of the repository and then it can be pushed. For example, the following with create an initial commit and push it to the server.
touch initial git add initial git commit -m "initial commit" git push -u origin master
Here’s another solution:
Just add and commit at least one change to your repo and re-run push command. You can add e.g.
Error: Failed To Push Some Refs To
You can read the text below the video if you don’t want to watch.
The following output can come up when you run Git:
To [email protected]:ola-s-test.git ! [rejected] your-branch -> your-branch (non-fast-forward)
Another person has pushed a commit to that same branch. And the commit isn’t on your computer. You might wonder why this is happening, it is because you have not pull in recent times and another person has worked on that branch.
The simple solution is this:
git pull origin <your-branch> git push origin <your-branch>
We can’t use computer without getting errors here or there. We can only find solution to each error as it arrives.
The remaining part of this post explains some of the benefits and weaknesses of GitHub and is GitHub necessary?
Benefits Of GitHub
Anybody Can Contribute To Your Code
On GitHub, anyone can contribute to open-source code.
It is just a mater forking the project, modify it and pull it back.
The process is simple. This simplicity is one of the reasons GitHub is so popular.
I can remember one of my friends back in college that is so lazy. We often make fun of him because he calls retrieving a project in GitHub work.
Someone that is just starting out as a developer will like the idea that GitHub is free.
A large collection of projects that you can lay your hands on without paying a dime.
It is a cool feeling to the serious-broke spirit of aspiring programmers.
GitHub has nearly all the documentation you will need to get a hold of Git.
That is one.
The documentation part of each project contains details of each part of the project. It is in this documentation you’ll find the function of each module.
Another important info you’ll find in the documentation is when each modification happened and the user that did it.
It Is A Geek Exhibition Platform
There have been countless stories where a programmer got hired after some recruiters search for a specific person that meets their requirements on the GitHub platform.
There is much usefulness of GitHub aside just dropping and modifying projects on it.
Although you don’t have to wait for recruiters to find your profile.
Plant the link to your GitHub profile in your CV every time.
However, you have to make sure you’ve got some nice projects on GitHub, or the ones you contribute to, before showcasing your profile.
This simple tactic can be the only reason why you will get the job.
It is definitely better than going to the best school in the world. Or the best code camp around.
The recruiters usually want to know if the candidate can do the work, and what a better answer than seeing a related work in your profile.
For example, you want to hire someone to clean your garden. Your friend told you that his brother can do the job.
While you are thinking about it, you saw your neighbors beautiful garden that he made by himself and he offered to do the job for you.
Who would you pick? You get the idea.
Weaknesses Of GitHub
Not So Secure
Companies that are serious about their projects will create a private Git for their projects.
It is not that GitHub is bad, but it is not a place for the important projects that companies execute.
GitHub has a private plan that isn’t free, this what some companies use.
It is only the staff of such companies and selected individuals by the companies that have access to the projects in the private plan.
Another reason people don’t like using GitHub for important work is the question of reliability.
The reliability of any website online isn’t 100% and a site like GitHub will definitely have people trying to attack it every now and then.
So no one can really vouch for GitHub on critical projects.
Price Can Be Very High
I don’t see any good reason why a company that has the IT team would want to get the paid plan of GitHub.
Just inform the team that you will need a server for Git.
The features on GitHub that will be suitable for a company’s staff isn’t free and will be costly if the staff are many.
A company will be better off setting up their own internal Git for the same purpose.
You will see more reasons for that when you think about the security aspect and the cost.
I have worked as an IT officer in a popular company right after my graduation from school…
Setting up and managing internal servers is one of the fun works I do.
So setting a Git should be easy for your IT team and your developers.
Is GitHub Necessary
GitHub is a positive edge for a developer over other developers when seeking for a job.
That is not news.
Out of every 1000 programmers CV, 15% of them use GitHub and 5% are active users of GitHub.
This is the reason why recruiters want that 5% category of people. And it is the reason why GitHub is necessary.
You now have the solutions to error src refspec master does not match any.
Read again or send me a message if anything isn’t clear to you in this post.