<?xml version="1.0" encoding="UTF-8"?>
<guide>
  <body>&lt;h2&gt;Overview&lt;/h2&gt;
&lt;p&gt;Run this simple command in a local git repository and it will open your browser to the relative github project page (if the repository was cloned from github). Add it to your ~/.bash_profile file.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://pastie.caboo.se/158400&quot;&gt;http://pastie.caboo.se/158400&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github=&quot;open `git config -l | grep 'remote.origin.url' | sed -n 
's/remote.origin.url=git@github.com:\(.*\)\/\(.*\).git/https:\/\/github.com\/\1\/\2/p'`&quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;If you&amp;#8217;re interested in working on tasty command line nuggets like the one above, please check out the &lt;a href=&quot;http://github.com/defunkt/github-gem&quot;&gt;GitHub gem&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit by savetheclocktower:&lt;/strong&gt; To get this to work, I had to escape the backticks so that the command within the backticks would not be evaluated until each time the alias is run. Without the backslashes, the command runs as soon as the alias is declared, at which time (at least in my case) it fails to find a &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github=&quot;open \`git config -l | grep 'remote.origin.url' | sed -n
's/remote.origin.url=git@github.com:\(.*\)\/\(.*\).git/https:\/\/github.com\/\1\/\2/p'\`&quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Edit by mkramlich:&lt;/strong&gt; That didn&amp;#8217;t fix it for me either, still broken, but got it closer. I also had to adjust the pattern to match the git &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt; syntax actually used in my remote.origin.url value. It now works perfectly for me as originally advertised, like this:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;alias github=&quot;open \`git config -l | grep 'remote.origin.url' | sed -n
 's/remote.origin.url=git:\/\/github.com\/\(.*\)\/\(.*\).git/https:\/\/github.com\/\1\/\2/p'\`&quot;&lt;/code&gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit by griff:&lt;/strong&gt; Here is one that combines the two above versions and therefore supports both git@github.com and git://github.com urls.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://pastie.caboo.se/202275&quot;&gt;http://pastie.caboo.se/202275&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github=&quot;open \`git config -l | grep 'remote.origin.url' | sed -En \
  's/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'\`&quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Edit by FiXato:&lt;/strong&gt; Here is one that takes griff&amp;#8217;s above version and makes it use &amp;#8216;konqueror&amp;#8217; instead of open (as that command seems to be missing on my system), and runs it backgrounded, with all commandline output surpressed. It also uses &lt;strong&gt;sed -r&lt;/strong&gt; instead of &lt;strong&gt;sed -E&lt;/strong&gt;, as the &lt;strong&gt;-E&lt;/strong&gt; argument was not supported by my version of sed (&amp;#8216;&lt;span class=&quot;caps&quot;&gt;GNU&lt;/span&gt; sed version 4.1.5&amp;#8217;).&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github=&quot;konqueror \`git config -l | grep 'remote.origin.url' | sed -rn \
  's/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'\` &gt; /dev/null 2&gt;&amp;1 &amp;&quot;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Edit by Leonid Volnitsky:&lt;/strong&gt; Yet another version(shorter and cleaner).  And yes, open is non standard, as is -E (deprecated?):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github='firefox `git config -l | 
sed -rn &quot;s^remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git^https://\2/\4^p&quot;`'&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Clarification by jacaetevha&lt;/strong&gt;: The &lt;strong&gt;open&lt;/strong&gt; command and the &lt;strong&gt;sed -E&lt;/strong&gt; argument are Mac (&lt;span class=&quot;caps&quot;&gt;BSD&lt;/span&gt;) specific.  So, if you want this to work on your Mac, keep them in there.  &lt;strong&gt;open&lt;/strong&gt; is a commandline program to use the default application for the argument passed to it (filename, &lt;span class=&quot;caps&quot;&gt;URL&lt;/span&gt;, etc).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Edit by jacaetevha&lt;/strong&gt;: Here&amp;#8217;s a version I use at work with a repository that started internally and then we push to Github.  The difference here is that the origin is not Github, so the RegEx needs to account for that.  It also works when Github is the origin.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github='open `git config -l | grep github | grep url | \
    sed -En &quot;s^(remote.*.url)=git(@|://)(github.com)(:|/)(.+/.+).git^https://\3/\5^p&quot;`'
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Edit by ches&lt;/strong&gt;: After much fussing, here&amp;#8217;s my version that will honor the currently active branch, or fall back to &lt;code&gt;master&lt;/code&gt; if there is not a matching remote branch. You cannot actually break the line with backslashes as shown here simply for clarity (I&amp;#8217;d suggest copying from the raw gist). As suggested by others, modify the OS X-specific &lt;code&gt;open&lt;/code&gt; and &lt;code&gt;sed -E&lt;/code&gt; with what is appropriate for you. If you see a simpler way to do this, do share.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://gist.github.com/90083&quot;&gt;http://gist.github.com/90083&lt;/a&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;alias github='br=$(git branch --contains HEAD | sed -En &quot;s/^\* //p&quot;); \
    if ! git ls-remote . | grep -q -e &quot;refs/remotes/.*/${br}&quot;; then br=&quot;master&quot;; fi; \
    echo $(git config -l | sed -En &quot;s%remote.origin.url=git(@|://)(github.com)(:|/)(.+/.+).git%https://\2/\4/tree/${br}%p&quot;)'
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;Edit by ssokolow&lt;/strong&gt;: Thanks to the Portland project, modern Linux has an equivalent to the open command named xdg-open. I&amp;#8217;ve forked ches&amp;#8217;s version of the alias to replace &amp;#8220;open&amp;#8221; with &amp;#8220;xdg-open&amp;#8221; and &amp;#8220;-En&amp;#8221; with &amp;#8220;-rn&amp;#8221;. Due to the linebreaking issues, I&amp;#8217;m just providing a gist link.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://gist.github.com/135000&quot;&gt;http://gist.github.com/135000&lt;/a&gt;&lt;/p&gt;</body>
  <created-at type="datetime">2008-02-26T20:48:14-08:00</created-at>
  <id type="integer">18</id>
  <permalink>jump-to-github-from-your-repository</permalink>
  <title>Jump to github from your repository</title>
  <updated-at type="datetime">2009-06-23T21:26:18-07:00</updated-at>
  <user-id type="integer">46915</user-id>
</guide>
