Monday, March 19, 2012

Cloning into a copy of GIT repo


I needed to get the files from under a file copy of a GIT repo. For some reason cloning into a remote repo didn't work, the remote machine kept hanging up on me. But I was able to scp into the machine and just grab the repo files. All I needed really was a quick look into someone else's work and figuring out how to properly clone the remote repo would take me longer so I figured what's the heck.

Here's my recipe:

  • copy the repo to some local location. let it be <REPO>
  • create a folder where you want your "true" local clone to reside. let it be <LOCAL>
  • fire up git bash and CD into the <LOCAL>
  • the following command sequence will get you where you want to be:
    $ git init
    $ git remote add main <REPO>
    $ git fetch main
    $ git checkout master
    
  • That's it. I now have my repo copy "unzipped", pretty much like if the original attempt to git clone it worked

Enjoy. Drop me a line if you know of a better way to unzip a copy of a git repo.

No comments: