Setup a local Git repo for libraries?


Hi All

The Problem:

I do a bit of work offline on my Ubuntu 16.04 laptop. A normal one, Intel Core i5, 8GB, Intel Graphics and 256GB SSD. Whenever I open up the library browser, the KiCad library browser attempts to connect to GitHub - did not debug much into what it is trying to do. Because of this, every time I try to place a symbol, footprint or just browse the libraries, the whole program hangs for a while.

The Solution:

I came up with an ingenious solution. Setup a local git mirror. Basically clone the repo manually and prevent KiCad from accessing the GitHub.

The Failure:

I cloned the GitHub repo. Only to realise tt is not so small. Effectively, my size-challenged SSD now maintaining two copies of the library. It turns out, it never picked up the mirrored copy, it still went to GitHub.

The Failure, Again:

This time, I played it smart. KiCad outsmarted me. Sort of. I did a bit of research and looked up the source code. I found a few places I think I could put replace GitHub URL with mirrored repo URL. KiCad did not pick up my local mirror, it made two copies of the repo. Still picked up the GitHub repo, cloned it and kept trying to connect to it everytime I used the library.

The Failure, This Time Its Personal:

I was not going to give up. I cloned the whole KiCad source and started grep’ing through the code for GitHub URI strings. And replaced them. Felt good. Titanic good. Now, my KiCad cannot find any libraries. I got multiple copies of the library occupying 12GB or so of precious space on my SSD and still KiCad could not find even one copy. I have to manually open each library every time I use the libraries.

The Question:

Had anyone solved this problem already? Is there an easier way? I could give it another go, but I prefer not to reinvent the wheel.



Why not?

My solution:
Keep your own copy of the libraries on your hard disk somewhere under /home
Delete all the library paths pointing to github and make them point to the “new” libraries.

This way, you are sure that no updating of the github repo will change anything on your libraries unless you do it on purpose. And more important, Kicad will no try to connect to the github repo all the time.


I think, you shouldn’t compile any code for this problem.

please have a look into ~/.config/kicad/kicad_common
there you can find all the configured paths.

Additionally you should replace any fixed path to Github, which you can find in your libraries (fp-lib-table) to a local one.

I suggest you to use the version 4 libs from my Github account, which is a hard fork and has some patches applied.
They need to set 3 environment variables in kicad_common. please have a look at our refrence card.


I believe the upcoming v5 release no longer goes out to Github for libraries.

If you want to make your Git repos smaller, do a “shallow clone” rather than a mirror by cloning them with “–depth 1”. You’ll still end up with two copies on your SSD (the repo plus the working copy) but you won’t be carrying all the history of all the revisions.


Thanks everyone. I’ll check the docs links out. I appreciate the link to the forked library. I’ll give it a try. I also love the idea of shallow cloning. Not sure why didn’t I think of that.

BTW, is there a shortcut to point the libraries directly to the cloned local mirror? That way we could avoid duplicate copies on the system.

Hopefully, the v5 solves me these problems. I’m a programmer by profession, but electronics engineer by nature. I don’t mind looking into the code, but that distracts me from what I intend to do when I fire KiCad up.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.