{"componentChunkName":"component---src-templates-blog-post-js","path":"/blog/2008/08/22/getting-git-to-work-on-os-x-tiger/","result":{"data":{"markdownRemark":{"html":"<p>If you haven’t heard of <a href=\"https://en.wikipedia.org/wiki/Git\">git</a> yet, it’s quickly becoming the preferred version-control system for tons of open-source projects, including the twin suns of <a href=\"https://github.com/rails/rails\">ruby on rails</a> and <a href=\"https://github.com/prototypejs/prototype\">prototype</a>.</p>\n<p>In fact, if you keep your eye on the <a href=\"https://github.blog/\">github blog</a> you’ll see a steady stream of well-known projects moving over to git, as diverse as the <a href=\"https://github.com/joshuaclayton/blueprint-css\">Blueprint CSS framework</a> and the <a href=\"https://gitlab.haskell.org/ghc/ghc\">Haskell compiler</a>.</p>\n<p>Basically, if <em>git</em> was a stock-market commodity, analysts would be issuing <strong>strong buy</strong> recommendations left, right and centre. Git’s <a href=\"https://en.wikipedia.org/wiki/The_Tipping_Point\">tipping-point</a> has arrived.</p>\n<h3>How to play</h3>\n<p><em>If you’ve arrived here via search-engine, it’s probably because you’re trying to work around errors like <strong>Can’t locate Error.pm</strong> or <strong>Can’t locate SVN/Core.pm</strong>. Read on…</em></p>\n<p>I already had macports installed, but if you haven’t, follow the <a href=\"https://www.macports.org/install.php\">macports install instructions</a> - we’ll be using macports to download and install git as it’s supposed to be simpler than building from source.</p>\n<p>If you’ve had macports installed a while, make sure it’s up to date:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">sudo port selfupdate</span></span></span></code></pre>\n<p>We want to use git to connect to subversion repositories as well, so we’ll just check that’s possible:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\">$ port list variant:svn</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">git-core        @1.6.0  devel/git-core</span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\">subversion      @1.5.1  devel/subversion</span></span></code></pre>\n<p>I already had subversion installed but through trial-and-error found I needed to reinstall it with perl-bindings (git must be using perl scripts to talk to subversion…) Note: I’m using the <code>-f</code> flag to force it to reinstall, you might want to try without first, just to see what conflicts it brings up:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">sudo port uninstall -f subversion-perlbindings</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">sudo port install -f subversion-perlbindings</span></span></span></code></pre>\n<p>Next, we install git:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk3\"># This may take a while to install with all its dependencies:</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">sudo port install git-core +svn</span></span></span></code></pre>\n<p>And finally, we check it works:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">mkdir myproject; </span><span class=\"mtk11\">cd</span><span class=\"mtk1\"> myproject;</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk3\"># Check your PATH&#39;s set properly, this should output:</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk3\"># fatal: Not a git repository</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">git svn</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk3\"># If that&#39;s OK... clone a repository:</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">git svn clone https://example.com/svn/project/trunk</span></span></span></code></pre>\n<h3>Can’t locate Error.pm</h3>\n<p>If you’re getting <em>Can’t locate Error.pm</em> or <em>Can’t locate SVN/Core.pm</em> you should immediately try:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">PATH=/opt/local/bin:</span><span class=\"mtk12\">$PATH</span><span class=\"mtk1\"> git svn</span></span></span></code></pre>\n<p>If that works, you know it’s just a <code>PATH</code> problem. It’s something to do with Apple’s perl install having slightly kooky ideas about where to store perl libraries.</p>\n<p>If you’re still getting complaints about Error.pm, you need to install the CPAN module - and we’re going to use the <code>/opt/local/bin</code> instance of cpan, to make sure things go in the right place for us:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">sudo /opt/local/bin/cpan -i lib::Error</span></span></span></code></pre>\n<p>Cross your fingers, and try again:</p>\n<pre class=\"grvsc-container default-dark\" data-language=\"bash\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">PATH=/opt/local/bin:</span><span class=\"mtk12\">$PATH</span></span></span>\n<span class=\"grvsc-line\"><span class=\"grvsc-source\"><span class=\"mtk1\">git svn clone https://example.com/svn/project/trunk</span></span></span></code></pre>\n<p>If things are working, git will spend a while cloning the subversion repository by pulling out every single revision so you can have a complete set of revisions (including deltas), ready for you to refer to with lightning-speed regardless of internet connectivity. Which is nice.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    position: relative;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n    line-height: 1.4;\n  }\n  \n  .grvsc-code {\n    display: table;\n  }\n  \n  .grvsc-line {\n    display: table-row;\n    box-sizing: border-box;\n    width: 100%;\n    position: relative;\n  }\n  \n  .grvsc-line > * {\n    position: relative;\n  }\n  \n  .grvsc-gutter-pad {\n    display: table-cell;\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  .grvsc-gutter {\n    display: table-cell;\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter::before {\n    content: attr(data-content);\n  }\n  \n  .grvsc-source {\n    display: table-cell;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-source:empty::after {\n    content: ' ';\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    user-select: none;\n  }\n  \n  .grvsc-gutter + .grvsc-source {\n    padding-left: 0.75rem;\n    padding-left: calc(var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem)) / 2);\n  }\n  \n  /* Line transformer styles */\n  \n  .grvsc-has-line-highlighting > .grvsc-code > .grvsc-line::before {\n    content: ' ';\n    position: absolute;\n    width: 100%;\n  }\n  \n  .grvsc-line-diff-add::before {\n    background-color: var(--grvsc-line-diff-add-background-color, rgba(0, 255, 60, 0.2));\n  }\n  \n  .grvsc-line-diff-del::before {\n    background-color: var(--grvsc-line-diff-del-background-color, rgba(255, 0, 20, 0.2));\n  }\n  \n  .grvsc-line-number {\n    padding: 0 2px;\n    text-align: right;\n    opacity: 0.7;\n  }\n  \n  .default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .default-dark .mtk1 { color: #D4D4D4; }\n  .default-dark .mtk3 { color: #6A9955; }\n  .default-dark .mtk11 { color: #DCDCAA; }\n  .default-dark .mtk12 { color: #9CDCFE; }\n  .default-dark .grvsc-line-highlighted::before {\n    background-color: var(--grvsc-line-highlighted-background-color, rgba(255, 255, 255, 0.1));\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, rgba(255, 255, 255, 0.5));\n  }\n</style>","timeToRead":3,"frontmatter":{"title":"Getting git to work on OS X Tiger","blurb":"Some lessons learned and tips to help migrate from Subversion to Git on OS X Tiger","date":"2008-08-22T11:58:10.000Z","modified":"2011-01-03T17:20:14.000Z"}}},"pageContext":{"slug":"/blog/2008/08/22/getting-git-to-work-on-os-x-tiger/","next":{"fields":{"slug":"/blog/2008/10/14/google-where-art-thou-time-conversion/"},"frontmatter":{"title":"Google: Where art thou time conversion?"}},"previous":{"fields":{"slug":"/blog/2008/08/20/php-session-management-grievance-2/"},"frontmatter":{"title":"PHP Session Management (grievance 2)"}}}},"staticQueryHashes":["1192980692"]}