blacksnipe
blacksnipe

Reputation: 41

Git Filter-branch doesn't remove folders?

I wanted to convert most of my repositories from my own SVN-server onto a hosted remote Git-server. I found a couple of commands and turned them into an automated shell script in order to convert the repositories in a smoother way.

Anyhow, that all worked, but now I'm getting unexpected EOF-errors from the hosted server whenever I'm trying to clone the git repository to work on it. Some big repositories (2 - 10 Gigs) take too long to import...

So I tried to use filter-branch for removing folders in order to reduce the size of the repositories by removing the biggest folders and graphic source files. It all worked on my computer, but when I want to upload to the git-server (after a looooong wait) I see the directories and files are still there!

I've tried using git repack to make sure the packs are also smaller and cloning the repository into a new folder, and it worked for the shrinking part of my problem, but when I went on with the git branch -m trunk master I received errors like:

1: error: refname refs/heads/trunk not found
2: fatal: Branch rename failed
3: error: src refspec master does not match any.
4: error: failed to push some refs to 'ssh://[email protected]/{username}/{projectname}'

I made a new commit for error #3, as explained on the following reply on a topic, but I had no progress what-so-ever...

I realize the errors are all connected together, but I don't understand why there's no trunk in the (local)cloned repository or why I suddenly have a couple of branches when I had just one master-branch in the other repos...

* [new branch]      origin/HEAD -> origin/HEAD
* [new branch]      origin/master -> origin/master

To make a long story of a lot of tries, shorter:

  1. I do a git svn clone --no-metadata -A -stdLayout to a new folder (projectname) with all history

    1b. I remove all the obsolete folders and files (defined per repository)

  2. I git init into a new repository (let's name it projectname-copy)
  3. I push everything into a bare repository I created using git init --bare bare-repo
  4. I try to upload to the hosted server, but I receive errors or no changes

Now my question is: does anybody have a solution for shrinking the repositories in size (local and remotely) and make it possible to upload them to my git-server?

PS: I think you'll know that writing commandline isn't my cup of tea, so please don't shoot me :-)

Upvotes: 3

Views: 667

Answers (1)

blacksnipe
blacksnipe

Reputation: 41

Never mind, I fixed it myself.

I made a local clone, did a git repack -A -d, followed by a git gc --prune=now && git gc --prune=now --aggressive and then I made a bare repo.

I had to check if the branches were correct, if not I made them with git branch -m [branchname] and then I could upload to my hosting.

Thought I'd share it with you guys :-)

Upvotes: 1

Related Questions