Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Git does not support pushing to a branch, that is checked out at the remote end.</p> <p>The recommended way is to use bare repository on the server. Normally you either push to the repository (and make it bare) or work on it, but not both. Even if you want to have a working copy on the server, I'd suggest you look at <a href="https://stackoverflow.com/questions/5219975/git-remote-for-testing">this question</a>.</p> <p>So you have two options:</p> <ol> <li>Make a bare repository (<code>mysite.com.git</code>) and a non-bare repository (<code>mysite.com</code>). In the bare repository, add a <code>post-update</code> hook to <code>git --git-dir=.../mysite.com pull</code></li> <li><p>Make just one repository and:</p> <ol> <li><p>Detach the head: <code>git checkout master@{0}</code></p></li> <li><p>Add a <code>post-update</code> hook to <code>git merge master</code></p></li> </ol> <p>The reason here is that git refuses to modify the checked-out branch, but if you uncheckout the branch, you will be able to push. And you will be able to update the working directory from a hook (hook is a script placed in <code>hooks</code> directory in the repository). You can either create a separate branch and check out that, or you can use the "detached HEAD" state (as suggested above&mdash;git remembers which branch is checked out by having a special reference "HEAD" that points to the branch, but if you check out something, that is not a branch, it is made to point to a revision directly and that's called a "detached branch" and since no branch is checked out, allows you to push to any of them).</p></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload