git 关于拉取大仓库的问题

736 阅读1分钟

当拉取一个大的远程仓库时,会拉取不下来,原因:当众多分支和提交历史数据超过了1g,要想完全拉取下来,是不可能的 。

解决方法: 浅克隆

git clone --depth=1 http://xxxx.git
git fetch --unshallow

在修改 .git/config

    [remote "origin"]
    url = https://github.com/xxx/project.git
    fetch = +refs/heads/master:refs/remotes/origin/master
    改为
    [remote "origin"]
    url = https://github.com/xxx/project.git
    fetch = +refs/heads/*:refs/remotes/origin/*