Skip to content

Instantly share code, notes, and snippets.

@ScalaWilliam
Last active August 27, 2016 14:19
Show Gist options
  • Select an option

  • Save ScalaWilliam/7c29a47e081a537605eef430a25f02b1 to your computer and use it in GitHub Desktop.

Select an option

Save ScalaWilliam/7c29a47e081a537605eef430a25f02b1 to your computer and use it in GitHub Desktop.
http://git.watch homepage
<!doctype html>
<html>
<head>
<title>Git Watch</title>
<style>
body {
font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif ;
margin-left:7em;
line-height:1.6;
}
pre {
line-height:1.6;
}
code {
background:rgb(245,250,250);
font-family:"Lucida Console", Monaco, monospace;
}
</style>
</head>
<body>
<h1>Git Watch</h1>
<p><a target="_blank" href="https://github.com/AptElements/git-watch">github.com/AptElements/git-watch</a></p>
<h2>Getting Started</h2>
<ol>
<li>Set up a GitHub WebHook to <code>http://git.watch/github/</code> with an optional secret. You can also <a href="/install/">Do it automatically</a></a></li>
<li>Install the client <code>npm install -g <a href="https://www.npmjs.com/package/gitwatch-client" target="_blank">gitwatch-client</a></code> (use the latest Node.js)</li>
<li>Listen for push events: <code>git-watch --url=<a href="http://git.watch/github/AptElements/git-watch" target="_blank">http://git.watch/github/AptElements/git-watch</a> --push-execute='echo deploying %sha% %ref%'</code></li>
</ol>
<h2>Notes</h2>
<h3>Security</h3>
<ul>
<li>The client-side application has explicit filters to ensure no injection takes place.</li>
<li>Everything is open to the world.</li>
<li>If you want to ensure legitimate github requests, add the <code>--secret=[secret you specified]</code> option to <code>git-watch</code></li>
</ul>
<h3>Deploying only <code>master</code></h3>
<pre><code>git-watch \
--url=<a href="http://git.watch/github/AptElements/git-watch" target="_blank">http://git.watch/github/AptElements/git-watch</a> \
--push-execute='
ref="%ref%"
if [ "$ref" = "refs/heads/master" ]; then
cd /path/to/repo &&
git pull origin $ref &&
echo "Updated $ref"
fi'
</code></pre>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment