Git does not push the master branch

0

I was using .git normally in my project, yesterday I typed something wrong and git started to return an alert from the corrupted index file.

Ok, I gave a git reset, I returned a commit and everything went back to normal.

Well, I worked this morning, the time I went to push my server, it just does not work, this is the error message (the terminal below):

Well, I'm not discovering the error, all folders are 777-enabled, and belong to the same group and user on both the local machine and the server.

Location: Ubuntu 16.4 LTS Server: Debian 7

Both are on the same network.

    
asked by anonymous 28.07.2017 / 15:04

2 answers

0

SOLUTION:

1 - Create a new branch on the local pc and set.

  

git checkout -b 'project'

2 - Request the push

  

git push --set-upstream origin project

From here, just use the command:

  

git push

    
28.07.2017 / 15:46
2

The git error refers to the loss or non-reference between your branch master and the remote master . Losing the HEAD reference.

When you started the project you applied the command git init ?

This means that anyone who applies the push "forcibly" to this branch will override the existing status of the verified working copy, ie the reference to HEAD. This is not a good thing.

To solve this, you use a repository discovered as a "community" repo (do this with git init --bare ) or work with brands from the master, as you did:

git checkout -b nome_branch

Make changes to this branch and apply commit . Then, push push your branch with git push origin nome_branch . After that, your remote branch can be "mergeado" in the master.

I always advise avoiding "commitar" in master . You can block this through the github site. Make it a habit to create branchs from the master and merge the changes to it. Do not forget to always update your master local git pull every time you create a new branch to always have the copy updated from the remote.

    
28.07.2017 / 16:15