0

I have a remote repo to which I want to push from my local machine via ssh. But because of the error mentioned here I can't do it without problems, because Iam getting remote errors when the server git suspects that I might damage files there.

'[remote rejected] master -> master (branch is currently checked out)'

The solution mentioned in the other question is to checkout to another branch on the server, that works but is quite annoying. Because I want to have running the master branch there and I don't like to have always switch to another branch on the server before pushing data from my local repo.

How can I solve that?

Asara
  • 2,791
  • 3
  • 26
  • 55
  • checkout to another branch and then push that branch. Then create a [PR](https://help.github.com/articles/about-pull-requests/) and merge to master. – caramba Nov 01 '17 at 17:10
  • No, the solution mentioned there is to use a bare repo, not to checkout a different branch. Git is oriented towards pull operations. So add a bare rpo on the server, push to it and pull from it to update the working tree at the server. – phd Nov 01 '17 at 17:12
  • Moreover, you should scan through *all* the answers to that other question. It's a bit unfortunate that none of them are marked accepted, and that the remaining answers show up in essentially random order, but the two key answers mention the `--bare` option and the (new in Git version 2.3) `updateInstead` option. – torek Nov 01 '17 at 17:57

0 Answers0