git clone --depth后重新发布存储库时出错

时间:2015-01-29 02:51:03

标签: git

以下是执行git clone的错误

mondwan@dev:~/Documents/github$ git clone http://192.168.0.22/git/abc.git cba
Cloning into 'cba'...
error: Unable to find 50a8c651844665d4a3cde27219fcef5fe49e8aab under http://192.168.0.22/git/abc.git
Cannot obtain needed commit 50a8c651844665d4a3cde27219fcef5fe49e8aab
while processing commit 38ac6499b3b3c6ab153956a47d0d07575a88f969.
error: Fetch failed.

以上问题是由于存储库中缺少历史记录。

以下是我如何设置abc.git存储库

的步骤
$> git clone --depth=1 https://github.com/angular/angular-seed.git abc
$> cd abc
$> echo "dummy" > dummy
$> git add . ; git commit -am 'dummy commit'
$> git remote add internal http://192.168.0.22/git/abc.git
$> git push internal master:master
Fetching remote heads...
  refs/
  refs/heads/
  refs/tags/
updating 'refs/heads/master'
  from 0000000000000000000000000000000000000000
  to   f56797c9db5a69a5b48073bab47db429e9f54134
    sending 38 objects
    done
Updating remote server info
To http://192.168.0.22/git/abc.git
 * [new branch]      master -> master
$> cd ..
$> git clone http://192.168.0.22/git/abc.git cba
Cloning into 'cba'...
error: Unable to find 6ca94d46e334b47e8e6066b2ea0ac79ffcee5c80 under http://192.168.0.22/git/abc.git
Cannot obtain needed commit 6ca94d46e334b47e8e6066b2ea0ac79ffcee5c80
while processing commit de30ee955c55ddf27b8fd15789ad18206bbbc285.
error: Fetch failed.

我能解决的唯一方法就是通过调用rm -fr .git并设置一个新历史来破坏旧历史。

我想知道有没有办法解决这个问题?

1 个答案:

答案 0 :(得分:0)

git pull
error: unable to find 2fcd18343b3817d1ed79a72c0c878811fd27e833

是我遇到的第一个错误之一。

简而言之,我建议使用:

git revert HEAD

(它可能不是最好的,但似乎有效)

How do I pull from a Git repository through an HTTP proxy?还给了我一些关于如何解决它的深刻见解!