Note that there are some explanatory texts on larger screens.

plurals
  1. PODeploy web site via Git
    text
    copied!<p>I work on a team of web developers. We each have a personal web site set up in our home directories on the development server.</p> <p>We want to convert them to git working repos so we can branch, rebase, and generally enjoy the benefits of git goodness.</p> <p>In reading online, there's a couple of options:</p> <p>1) create a bare repo that syncs to the working repo in www/ via a post-receive hook</p> <p>2) push directly to the working repo</p> <p>Problem with option 1 is it doesn't handle branching well. When we push a branch other than master, the post-receive hook still only syncs master so our changes never appear on the development site.</p> <p>Problem with option 2 is git disallows pushing to a checked-out branch to prevent a detached HEAD state.</p> <p>In reading around the web, the "best practice" solution to option 2 goes something like this:</p> <p>1) on CLIENT push to dummy branch</p> <p>2) on SERVER merge dummy into master... <em>BUZZZZ</em> wrong answer. Assume the end users don't have shell access to the server.</p> <p>So I thought, "no problem, just create a post receive hook like this":</p> <pre><code>#!/bin/bash read oldSHA newSHA branch git merge $branch </code></pre> <p>Now here's the weird part: when the post-receive hook executes I get</p> <pre><code>Please, commit your changes or stash them before you can merge. </code></pre> <p>Yes, I have confirmed that master is the checked-out branch on the server, and that the dummy branch has been updated correctly. When I run the very same command (git merge dummy) directly on the server, everything works fine.</p> <p>Can anyone explain why?</p> <p>Thanks in advance.</p> <p><strong>EDIT 1</strong></p> <p>Here are the results of git status, both pre-merge and post-merge</p> <pre><code>Counting objects: 5, done. Delta compression using up to 8 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 307 bytes, done. Total 3 (delta 2), reused 0 (delta 0) remote: **** PRE MERGE **** remote: # On branch master remote: # Untracked files: remote: # (use "git add &lt;file&gt;..." to include in what will be committed) remote: # remote: # COMMIT_EDITMSG remote: # FETCH_HEAD remote: # HEAD remote: # ORIG_HEAD remote: # config remote: # description remote: # hooks/ remote: # index remote: # info/ remote: # logs/ remote: # objects/ remote: # packed-refs remote: # refs/ remote: no changes added to commit (use "git add" and/or "git commit -a") remote: error: Your local changes to the following files would be overwritten by merge: remote: index.htm remote: Please, commit your changes or stash them before you can merge. remote: Aborting remote: **** POST MERGE **** remote: # On branch master remote: # Changes not staged for commit: remote: # (use "git add &lt;file&gt;..." to update what will be committed) remote: # (use "git checkout -- &lt;file&gt;..." to discard changes in working directory) remote: # remote: # modified: index.htm remote: # remote: # Untracked files: remote: # (use "git add &lt;file&gt;..." to include in what will be committed) remote: # remote: # COMMIT_EDITMSG remote: # FETCH_HEAD remote: # HEAD remote: # ORIG_HEAD remote: # config remote: # description remote: # hooks/ remote: # index remote: # info/ remote: # logs/ remote: # objects/ remote: # packed-refs remote: # refs/ remote: no changes added to commit (use "git add" and/or "git commit -a") </code></pre> <p>Note that I can do a manual git add ., git commit -m "foo" and re-do this process with the same result</p>
 

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