fatal: The current branch master has no upstream branch

fatal: The current branch master has no upstream branch

Today, I had this strange issue on the production server.

I always pull from origin from that server and I never do any work on it. So to my surprise when doing a git pull I got a report saying I will overwrite changes!! Well, how did that happen?? I have no idea.

On closer inspection I find that the composer.lock file has changed. It has new hash's in it.

I don't know if this is a thing or not but maybe composer updates itself.....who knows....couldn't find any results from a web search so I thought I just gonna get on with it.

Here's what I did:

(Not relevant:) I looked at the composer.json on my development server and realised it was set up wrong.

So, I made the changes to the composer.json on the production server.

Deleted the composer.lock file

Ran composer update.

git add -A

git commit -m "message"

git pull from github repo which caused a merge

Now I just needed to push the changes to the origin (github)

git push  ´╗┐git@github.com:username/repo.git

But I get this message "fatal: The current branch master has no upstream branch"

But failed to notice this bit


To push the current branch and set the remote as upstream, use

    git push --set-upstream git@github.com:username/repo.git master

Don't forget to put the "master" or reference to the branch

Then, just to finish my story....

I pulled from origin (github) to my dev server and carried on like nothing happened