diff options
| author | tekkub <tekkub@gmail.com> | 2010-01-17 02:29:19 -0700 |
|---|---|---|
| committer | tekkub <tekkub@gmail.com> | 2010-01-17 02:29:19 -0700 |
| commit | e6765dcbe4161d70a014cce74cd099fed0429ca1 (patch) | |
| tree | 5bffa11e43cbb1221bb24cee1932a47ee87e026d | |
| parent | 434c507742b1bce8cd928baebc3f32b06a46e62c (diff) | |
Some new (old) guides
| -rw-r--r-- | _layouts/default.html | 1 | ||||
| -rw-r--r-- | _posts/2009-06-20-git-email-settings.textile | 4 | ||||
| -rw-r--r-- | _posts/2010-01-16-api.markdown | 69 | ||||
| -rw-r--r-- | _posts/2010-01-16-deploy-keys.markdown | 32 | ||||
| -rw-r--r-- | _posts/2010-01-17-capistrano.textile | 89 |
5 files changed, 194 insertions, 1 deletions
diff --git a/_layouts/default.html b/_layouts/default.html index 64c1e2e..1d40e09 100644 --- a/_layouts/default.html +++ b/_layouts/default.html @@ -4,6 +4,7 @@ sidebar_cats: - troubleshooting - repos - collaborating +- deploying - mac - windows - linux diff --git a/_posts/2009-06-20-git-email-settings.textile b/_posts/2009-06-20-git-email-settings.textile index 6898ed7..f4dcadb 100644 --- a/_posts/2009-06-20-git-email-settings.textile +++ b/_posts/2009-06-20-git-email-settings.textile @@ -28,7 +28,9 @@ $ git config user.email "not@tekkub.net"</pre> h2. GitHub token config -Some tools connect to GitHub without SSH, for these tools you need to set your "local GitHub config":http://github.com/blog/180-local-github-config. You can find your token at the top of the "account page":https://github.com/account +Some tools connect to GitHub without SSH, for these tools you need to set your "local GitHub config":http://github.com/blog/180-local-github-config. You can find your token on the "account page":https://github.com/account + +!http://img.skitch.com/20091209-k5x2xa1rrc889deqmp53464m8n.png! <pre class="terminal">$ git config --global github.user tekkub $ git config --global github.token 0123456789abcdef0123456789abcdef</pre> diff --git a/_posts/2010-01-16-api.markdown b/_posts/2010-01-16-api.markdown new file mode 100644 index 0000000..a57a1d0 --- /dev/null +++ b/_posts/2010-01-16-api.markdown @@ -0,0 +1,69 @@ +--- +layout: default +title: GitHub API +categories: other +--- + +__This page is for version 1 of the API. While this API still works, it has been replaced. We highly recommend you use the [new version](http://develop.github.com/).__ + +The API +======= + +Request will follow a common URL pattern: + + http://github.com/api/v1/:format/:username/:repository/:type/:object + +* Acceptable formats: json, xml, yaml + +* Acceptable types: commits, commit + +Grabbing all recent commits: + + $ curl -i http://github.com/api/v1/xml/caged/gitnub/commits/master | less + +Grabbing a single commit: + + $ curl -i http://github.com/api/v1/json/defunkt/github-gem/commit/c26d4ce9807ecf57d3f9eefe19ae64e75bcaaa8b | less + +Repository search: + + $ curl -i http://github.com/api/v1/xml/search/merb | less + +You can also grab a user's info, including a list of his repositories (Using [token authentication](http://github.com/blog/170-token-authentication) will enable listing of private repositories.): + + $ curl -i http://github.com/api/v1/json/defunkt | less + +With JSON requests, you can have the result passed to a callback method of your choice: + + $ curl -i http://github.com/api/v1/json/defunkt?callback=myCallbackMethod | less + +Projects using the API +====================== + +* [GitHub Badge](http://drnicjavascript.rubyforge.org/github_badge/) (see also [initial blog post](http://drnicwilliams.com/2008/05/03/github-badge-for-your-blog/)) + +* [Badjo](http://github.com/zmack/badjo/tree/master) + +* [YAGHB](http://github.com/schleyfox/yaghb/tree/master) - Yet another github badge + +* [textmate gem](http://github.com/wycats/textmate/) -- Command-line package manager for textmate + +* [github commit badge](https://github.com/heipei/github-commit-badge/tree) - GitHub commit badge, showing the most recent commits of chosen repos + +* ['gadgets' project and 'demo generator'](http://github.com/andyatkinson/gadgets/tree/master) (see also [initial blog post](http://webandy.com/2008/11/15/gadgets-and-demo-generator)) + +* [GitHub Projects Wordpress Plug-in](http://github.com/tristandunn/wp-github-projects/tree/master) - Also at the official Wordpress [plug-in directory](http://wordpress.org/extend/plugins/github-projects/) + +* [github-repos](http://github.com/johnbender/github-repos/tree/master) - [Tutorial and Example](http://nickelcode.com/2008/11/27/github-repo-information-in-your-webpages/) + +* [github-terminal](http://github.com/prtksxna/github-terminal/tree/master), working example at [Github Terminal](http://prtksxna.github.com/github-terminal/) + +* [git-trip](http://github.com/Oshuma/git-trip/tree) - Visualize git repositories. + +* [github-social-badge](http://github.com/kentbrew/github-social-badge) - Social badge: visualize projects and followers. [Working example](http://kentbrew.github.com) + +* [codeigniter-github](http://github.com/philsturgeon/codeigniter-github/tree/master) - CodeIgniter / PHP wrapper library. + +* [github user page bookmarklet](http://tagaholic.me/2009/04/06/github-bookmarklet-for-user-pages.html) - adds additional repo stats to github user pages and provides repository sorting. + +* [RefactorMe](http://www.refactorme.com) - Site posts daily code snippets from open source projects. All code is powered by Github Gists' and the site will also create the gist for users if they do not want to create it themselves. diff --git a/_posts/2010-01-16-deploy-keys.markdown b/_posts/2010-01-16-deploy-keys.markdown new file mode 100644 index 0000000..374d3f0 --- /dev/null +++ b/_posts/2010-01-16-deploy-keys.markdown @@ -0,0 +1,32 @@ +--- +layout: default +title: Understanding deploy keys +description: Do you need a deploy key? +categories: deploying +--- + +Deploy keys are a handy yet misunderstood feature here on github. This guide will explain when and how to use them instead of normal user keys. + +What are deploy keys? +===================== + +Deploy keys are ssh keys just like the ones you attach to your account to allow you to push to and pull from your repos. The only difference is that deploy keys are designed to allow access to a single private repo. This will allow your staging or production server to pull in from your repo, most likely using a deploy tool like [Capistrano](http://www.capify.org/). + +Remember, ssh keys are unique, you cannot use the same key on two repos, or on a repo and a user account. + +When should I use a deploy key? +=============================== + +Simple, when you have a server that needs pull access to a single private repo. + +I'm working with public repos, do I still need deploy keys? +----------------------------------------------------------- + +No! You can simply use the public clone URL for the project. + +My server needs access to many private repos, how do I handle this? +------------------------------------------------------------------- + +The simplest way is to add your server's key to the account of the repo owner. This will allow the server access to any private repo that user owns or is a collaborator on. + +If you don't want your deploy server to have access to every repo, you can make an account specifically for the server, attach its key to the account, and add that account as a collaborator to any repo you do want access to. diff --git a/_posts/2010-01-17-capistrano.textile b/_posts/2010-01-17-capistrano.textile new file mode 100644 index 0000000..4365a18 --- /dev/null +++ b/_posts/2010-01-17-capistrano.textile @@ -0,0 +1,89 @@ +--- +layout: default +title: Deploying with Capistrano +description: How to set up capistrano to pull from a GitHub repo +categories: deploying +--- + +To prepare your project for "Capistrano":http://www.capify.org/, go into the root directory of that project and run @capify@: + +<pre class="terminal"> +$ cd my_project +$ capify . +</pre> + +h2. Generate Public Key + +It would probably be a good idea to add a special user on your server(s) specifically for deployment. Once created, make sure to generate a public key for the server and add it to your github account. You may also want to add your personal public key to this new user's @~/.ssh/authorized_keys@ to ease deployment. + +For more help with deploy keys, see "this guide":/deploy-keys. + +h2. Settings + +Here are the 5 most notable Capistrano config options (found in deploy.rb): + +<pre> +default_run_options[:pty] = true # Must be set for the password prompt from git to work +set :repository, "git@github.com:vanpelt/rails-app.git" # Your clone URL +set :scm, "git" +set :user, "deployer" # The server's user for deploys +set :scm_passphrase, "p@ssw0rd" # The deploy user's password +</pre> + +h3. Agent Forwarding + +If you're using your own private keys for git you might want to tell Capistrano to use agent forwarding with this command. Agent forwarding can make key management much simpler as it uses your local keys instead of keys installed on the server. + +<pre>ssh_options[:forward_agent] = true</pre> + +h3. Set Branch + +You need to tell cap the branch to checkout during deployment: + +<pre>set :branch, "master"</pre> + +Older versions of cap need the full branch name: + +<pre>set :branch, "origin/master"</pre> + +Older versions of git (e.g. 1.4.4.2) don't support @git checkout -q@, this will cause your deployment to fail. To fix either upgrade git or: + +<pre>set :scm_verbose, true</pre> + +h3. Remote Cache + +In most cases you want to use this option, otherwise each deploy will do a full repository clone every time. + +<pre>set :deploy_via, :remote_cache</pre> + +Remote caching will keep a local git repo on the server you're deploying to and simply run a fetch from that rather than an entire clone. This is probably the best option as it will only fetch the changes since the last. + +h3. Shallow Clone + +As an alternative to the remote cache approach, you can use shallow cloning. + +<pre>set :git_shallow_clone, 1</pre> + +Shallow cloning will do a clone each time, but will only get the top commit, not the entire repo. This makes it a bit closer to how an svn checkout works. Be warned, shallow clone won't work well with the @set :branch@ option. + +h3. Submodules + +If you're using git submodules you must tell cap to fetch them. + +<pre>set :git_enable_submodules, 1</pre> + +h2. Migrating from SVN + +Migrating from SVN-based deploys? "Check this thread":http://groups.google.com/group/github/browse_frm/thread/c5d2620c541e4e1a if you run into any problems. + +h2. Known Hosts bug + +If you are not using agent forwarding, the first time you deploy may fail due to Capistrano not prompting with this message: + +<pre class="terminal"> +The authenticity of host 'github.com (207.97.227.239)' can't be established. +RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48. +Are you sure you want to continue connecting (yes/no)? +</pre> + +To fix this, ssh into your server as the user you will deploy with, run <code>ssh git@github.com</code> and confirm the prompt. |
