lesto lesto - 3 months ago 31
Git Question

How to clone git repository from its zip

I'm trying to clone a remote repository on github, but it is big and my connection doesn't seem to be stable enough, so I can't clone it successfully.

But I have successfully downloaded the .zip of the repository.

Is there a way to use this zip as it was created by git clone, so I can push, pull etc..?

Answer

A related post here provides the information needed to grab the .git directory and simplify the answer that umläute provided:

  • Grab the .git directory by cloning a bare repository

    $ mkdir repo $ git clone --bare http://github/user/repo repo

  • Make the .git directory and move the cloned files

    $ mkdir repo/.git $ mv repo/* repo/.git

  • Unzip the repository

    $ unzip repo.zip

  • Re-initialize the repository

    $ cd repo $ git init

  • Verify you're sync'ed

    $ git pull

  • Reset the HEAD to clean up the status

    $ git reset HEAD

  • Here's the log for the repo ... repo location - http://github.com/udacity/fullstack-nanodegree-vm

    $ git log commit ebcbda650bc81d7f4856f5314a0689cea5b43086 Merge: 574774b b5b787e Author: Karl Krueger <karl@udacity.com> Date: Tue Apr 7 11:39:54 2015 -0700

        Merge pull request #3 from pmallory/sharedDirAlert
    
        Add a login alert to explain how to access Vagrant's shared directory
    

    commit b5b787efdb1ecec0c3c9c7f9c0fd4732f984fcb3 Author: Philip Mallory <philip@udacity.com> Date: Mon Apr 6 15:40:32 2015 -0700

        move the alert into the motd
    

    commit b8012f33c86b0d19fc4c2b972af092e88d00978f Author: Philip Mallory <philip@udacity.com> Date: Mon Apr 6 14:32:01 2015 -0700

        Add a login alert to explain how to access Vagrant's shared directory
    

    commit 574774ba29ccd661154431d5600240f090440c37 Author: Lorenzo Brown <lorenzo@udacity.com> Date: Wed Mar 11 14:08:02 2015 -0700

        Update pg_config.sh
    
        Added installs for Auth&Auth
    

    commit 88fc5537b1a0017a1d76af4587a22412473809a4 Author: Lorenzo Brown <lorenzo@udacity.com> Date: Wed Mar 4 13:00:25 2015 -0800

        Update and rename vagrant to vagrant/catalog/README.txt
    

    commit f978cdc14c62b7295d8da1a95452faaa1bd108b8 Author: Lorenzo Brown <lorenzo@udacity.com> Date: Wed Feb 4 11:06:03 2015 -0800

        Update Vagrantfile
    
        switched to port forwarding on 8080
    

    commit d6a3a26578ef3c6d01d28abca76d817938892c7f Author: Lorenzo Brown <lorenzo@udacity.com> Date: Tue Feb 3 14:52:34 2015 -0800

        Update Vagrantfile
    
        Added:
    
        config.vm.network "forwarded_port", guest: 80, host: 8080
        config.vm.network "forwarded_port", guest: 5000, host: 5000
    
        FSF uses these two ports for lessons 2 & 3 respectively.
    

    commit 752a79e408c7328ef7f1766d1b97bb468ffed90a Author: Mike Wales <michael.wales@udacity.com> Date: Mon Feb 2 11:21:29 2015 -0800

        Removed .vagrant directory
    

    commit 5af9d19adf9ab19b1d886f6cc78e556f864b42dd Author: Mike Wales <michael.wales@udacity.com> Date: Mon Feb 2 11:16:45 2015 -0800

        Initial commit.
    
Comments