0

Below are errors for doing 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.

Above problems are due to fact that there are missing history in the repository.

Below are steps for how I setup abc.git repository

$> 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.

The only way I can fix is destroying the old history by calling rm -fr .git and setup a new one.

I am wondering are there any alternative to tackle this issue?

Mond Wan
  • 1,862
  • 2
  • 17
  • 21

0 Answers0