1

只拿到了一个分支一个 commit, 再运行 fetch 也拿不到其他的分支和 commits 了.
尝试了 git fetch --all git fetch origin 无效.
用什么命令来获取完整的仓库呢?


更新:

搜到一段文章说不能继续... 不知道是不是真的:
http://strk.keybit.net/blog/2011/06/07/getting-just-the-tip-of-a-remote-git-branch/

A shallow repository (one with short history) cannot be further cloned,

题叶 16.4k
2014-02-15 提问
7 个回答
3

已采纳

参考 @Leedy@依云 的答案, 找到有个 unshallow 参数:

git fetch --help


--unshallow
           Convert a shallow repository to a complete one, removing all the limitations imposed by shallow repositories.
3

(你们就在评论里解决问题了?)

$ git version
git version 1.8.5.3

$ git help clone
...
       --depth <depth>
           Create a shallow clone with a history truncated to the specified
           number of revisions. A shallow repository has a number of
           limitations (you cannot clone or fetch from it, nor push from nor
           into it), but is adequate if you are only interested in the recent
           history of a large project with a long history, and would want to
           send in fixes as patches.
...

可见 git shallow clone 只能 clone 当前 remote/HEAD 的目录结构,不包括历史,因此不是完整的 repo。

However,Git 1.9/2.0 已经去除了这个限制,见 https://github.com/git/git/commit/82fba2b9d39163a0c9b7a3a2f35964cbc039e1a

参考:http://stackoverflow.com/questions/6941889/is-git-clone-depth-1-shallow-clone-more-useful-than-it-makes-out

1
$ git fetch --help

--depth=<depth>

Deepen or shorten the history of a shallow repository created by git clone with --depth= option (see git-clone(1)) to the specified number of commits from the tip of each remote branch history. Tags for the deepened commits are not fetched.

1

$ git clone --depth 1 https://github.com/dogescript...
$ git remote set-branches origin 'remote_branch_name'
$ git fetch --depth 1 origin remote_branch_name
$ git checkout remote_branch_name

stackoverflow上的一个答案, 个人问题可以解决
https://stackoverflow.com/que...

0

git pull --unshallow

0
  1. vim .git/config
  2. 按照如下示例修改:
[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://github.com/ReactiveX/rxjs
    fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
    remote = origin
    merge = refs/heads/master

修改成:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "origin"]
    url = https://github.com/ReactiveX/rxjs
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
  1. git fetch -v

撰写答案

你可能感兴趣的

推广链接