Git does not push to the master branch

Asked

Viewed 685 times

0

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

Okay, I did a git reset, I came back a commit and everything went back to normal.

Well, I worked this morning, at the time I went to push to my server, it just doesn’t work, that’s the error message (the bottom terminal):

inserir a descrição da imagem aqui

Well, I am not discovering the error, all folders are with permission 777, and belong to the same group and user both on the local machine and on the server.

Location: Ubuntu 16.4 LTS Server: Debian 7

Both are on the same network.

  • Have you tried running the command with sudo?

  • This error has already been run with open sudo

2 answers

2

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

When starting the project you applied the command git init?

This means that anyone who pushes "forcibly" to this branch will replace the existing status of the verified working copy, i.e., the reference to HEAD. That’s not a good thing.

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

git checkout -b nome_branch

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

Always avoid "committing" to master. You can block this through the site github. Make a habit of creating branchs from the master and "merge" the changes in it. Just be sure to always update your master local git pull every time you create a new branch to always have the updated copy from the remote.

  • I am not using github in this project, my repository is internal because it is an intranet system, it would block the master branch for all users of the network except the server admin?

  • As far as I know and from what I could quickly research. This concept applies is github, not git. So in your case it would no longer work. I don’t know why you have created an internal repository, but if it’s just to have it as a private, there are two solutions in the free market that can help you apply what I explained in the answer. gogs and gitlab

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.