git - 如何从其 zip 克隆 git 存储库

标签 git github zip git-clone

我想在github上克隆一个远程仓库,但是它很大而且我的连接似乎不够稳定,所以我无法成功克隆它。

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

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

最佳答案

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

  • 通过克隆裸存储库获取 .git 目录

    $ mkdir repo
    $ git clone --bare http://github/user/repo repo
    
  • 制作.git目录并移动克隆的文件

    $ mkdir repo/.git
    $ mv repo/* repo/.git
    
  • 解压仓库

    $ unzip repo.zip
    
  • 重新初始化存储库

    $ cd repo
    $ git init
    
  • 验证您已同步

    $ git pull
    
  • 重置HEAD清理状态

    $ git reset HEAD
    
  • 这是存储库的日志...存储库位置 - 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.
    

关于git - 如何从其 zip 克隆 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15681643/

相关文章:

Git 已安装,但 .git 目录不存在,所以我无法配置它

android - 将 google-services.json 提交到 GitHub

macos - 压缩两个内容相同的文件,但最终的 md5sum 不同

windows - Windows 和 Linux 目录名称中禁止使用哪些字符?

git - 如何获取 git SHA 的关联引用路径?

git - 删除完整的 Git 历史而不删除存储库?

linux - 如何在 github 上为 1 个用户的 2 个 repo 添加部署 key

php - ftp_exec() 的替代品?

windows - 当某些文件名包含星号时无法在 Windows 上克隆 git repo

git - 无法推送到 GitHub 上的远程存储库