如何从其 zip 克隆 git 存储库 [英] How to clone git repository from its zip

查看:39
本文介绍了如何从其 zip 克隆 git 存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 github 上克隆一个远程存储库,但是它很大而且我的连接似乎不够稳定,所以我无法成功克隆它.

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.

但是我已经成功下载了存储库的 .zip.

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

有没有办法使用这个 zip 文件,因为它是由 git clone 创建的,所以我可以推、拉等......?

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

推荐答案

相关帖子 此处 提供获取 .git 目录所需的信息并简化 umläute 提供:

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

  • 通过克隆一个裸仓库获取 .git 目录

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

  • 创建.git目录并移动克隆的文件

    $ 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
    

  • 重置 HEAD 以清理状态

  • Reset the HEAD to clean up the status

    $ git reset HEAD
    

  • 这里是 repo 的日志...... repo 位置 - 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.
    

  • 这篇关于如何从其 zip 克隆 git 存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆