2

we just try to move our project from old server to gitlab.and I choose to use the method

git clone --bare git@xxx.git

git push --mirror gitlab git@xxx.git

However,three of my four projects are behave ok,just the left one occour the problem. I have tried

 git ls-tree

and

 git replace

it won't work. and as I am almost a new to git,I don't know what to do,anyone can help? 3Q

郑迎风
  • 65
  • 1
  • 9

1 Answers1

1

Try one of the methods of "Tree contains duplicate file entries".

Once you know which element is involved, you can use a filter-branch to remove it: see "duplicate file error while pushing --mirror into Git repository"

git filter-branch -f --index-filter \
  'git rm -rf --cached --ignore-unmatch <yourFile> && \
   git ls-files -s | git update-index --index-info' \
--prune-empty --tag-name-filter cat -- --all"

(Replace <yourFile> by the problematic element)

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes try to look at git bundle: it will compress your git repo in one file that you can copy over to your server, and clone --bare from that file, replacing your gitlab bare repo with this one. – VonC Jun 21 '17 at 10:30
  • yes,it works,3Q very much I forgot to replace SampleApp – 郑迎风 Jun 21 '17 at 10:43
  • @郑迎风 Great! I have edited the answer with the filter-branch command, and make it visible that you have to replace `` (SampleApp for instance) by your actual problematic file. – VonC Jun 21 '17 at 13:59