Multi user access to libraries in 6

I know this is a question that has been often asked but all date back a few years so I think I am best getting an up to date answer. Can more than one person simultaneously open/edit the kicad libraries in a shared location?

1 Like

No, you cannot have multiple users editing the same files at the same time (for example, by putting the files on a shared network drive) – KiCad will not handle the scenario if both users edit the file and try to save. The solution described by @Andy_P is also what I would recommend.

1 Like

what sort of a system do I use to do this?

There is some useful info in this FAQ article. It is aimed at KiCad 5 but most still applies in version 6 (the path variables are different but the concepts are the same). Some familiarity with VCS is helpful and subversion or a non-distributed, lockable VCS has some advantages.

Thank you but I am now totally confused.

My impression is that when I want to place a component in KiCad at the least a list of components is loaded the first time but not after that. So I would assume that if a second user were to add a component to one of those libraries the first would never know it existed unless they restarted.

So what happens if both users make an edit to the same library, I guess that is when the real problems will start. So does a policy of only one user editing at a time work?

I see no clear explanation as to how I get KiCad to work with any other tools to manage the libraries. KiCad expects to find the libraries in a certain location, how would Git for example (no idea how it works) change the behaviour of KiCad to stop conflicts.

If no one edits the libraries, would more than one person be able to use them at the same time?

Well, there are at least two issues here:

  1. Editing library files so that two persons/editors/scripts/whatever write to the same file simultaneously. This doesn’t work because whoever saves last wins. Git or some other VCS can help with the symbol libraries because it’s possible to edit two different symbol and merge the changes without a conflict. However, this doesn’t help with one and the same footprint or symbol because there would be conflicts.

  2. Informing all users that something has been changed and reloading the libraries. Indeed, KiCad doesn’t reload the files automatically and doesn’t inform the in any way. The team must use some other way of communication, and each user must reload the libraries.

That’s something for the developers to think about when the library system is enhanced.

1 Like

So basically the most important thing to avoid is two people editing at once. Next if an edit is made then yes KiCad needs restarting.

I am not clear on what interaction there is between KiCad and the library files. Are they loaded the first time they are needed like putting a symbol in a schematic and only written back if an edit is made?

I have no idea how a revision control system is supposed to work. Would this allow access to the libraries by more than one user or is it more about tracking changes and copying the new versions over when available and no users are using the libraries.

So is each file replaced with the newer version or is this actually adding changes in the master files to each users files?

A very short and incomplete introduction to git:
Every user has a complete copy of the library, and can do with it as he / she wishes. Add new symbols, change existing ones, delete symbols, etc. Git has a built in system to track all the changes each person makes, but the changes are all local.

At some point, you want to re-synchronize all the changes that those people made, for example, so that a new footprint you made can be used by the rest of the group. To do this, git has a “master” repository that is accessible by everybody in the group. This master should be in a central location that can be accessed by everybody. For example on a website like gitlab. Then, to re-synchronize, you merge the changes you made into the “master”, and the others re-syncronize with the master after that to pull the changes you made.

This should be easy in most situations, If however multiple people have changed the same part (lets take a resistor for example) then conflicts may arise, but git has built-in functions to help with resolving such differences. Git also keeps track of when changes were made, who made the changes and exactly what was changed each time.

To experiment a bit with this, you can for example have a look at a website like Wikipedia. (Which also uses git). If you press the View History button of any Wikipedia article:

then you can select any two older versions (the green dots at 1. and 2.) and then in step 3, press Compare selected revisions

In this way Wikipedia can let anybody make changes. Certain people are alerted if changes are made, and if they don’t like the changes you made, it’s simply reverted. (Wikipedia also has special methods for dealing with vandalism, politically sensitive topics and other sorts of problems, but the default is that anybody can make a change to an article.

Git was originally designed to work with source code for programs, but it works quite good with anything that is text based. This leaves te problem with graphic stuff such as schematics in KiCad. Although the files are are text-based, it’s hard to interpret by humand. For this there are helper programs that can make the differences visual in a graphical way. For this, see for example:
Visual Schematic Diffs In KiCAD Help Find Changes | Hackaday

There are a lot of different VCS (Version Control systems) and Git has become quite popular since it’s introduction in Git - Wikipedia It’s one of the most successful Open source projects and was started by Linus himself.

To get back to:

With Git, each user has a local copy of the complete history, and is free to do with it whatever they want on their own PC. It’s quite easy to “check out” an old version of a library, for example if you have to make some changes to a project you did for some customer long ago.

KiCad itself, and the KiCad libraries are also all put into git repositories, and hosted on gitlab Gitlab has also built a lot of services around git, such as a chat system in which users can communicate with each other such as filing bug reports or announcing when issues are fixed.

This is just a general description of a part of what git can do. Many books and websites have been written about it and you should do some reading there if this topic interests you.

Because of all this, git is also a “backup system on steroids”. You can make some wild changes to your PCB, and if it turns out to be a bad change, then you simply revert to a version from before you did something *&^%$#@! If you have synchronized the git database with some external location, then even your whole PC may crash or your house with everything in it may burn down, but your project is still easy to recover.

1 Like

Right it’s starting to make sense. So is anything installed on the server or does the desktop client handle everything? I only see one download. Once I have a desktop client do I need to install something on the central server if say we use the work server or other online hosting?

Looks like I have a 500 page book to read about it :open_mouth:.

You have to install git itself on the server, and on any system you want to work with git.

Git is very flexible, it can use SSH, http and a bunch of other methods for data transfers.

If you want to go really dumb, you can manually copy a git repository to an USB stick (file server, whatever) and at a later time or other location copy it again. However, for this does cripple git a bit because an important part of git is to track which user makes each change to the database, and this gets damaged if you do this.

If you are able to setup a server connected to the Internet and install and configure git and SSH then you already have a solid base to work with. Alternatively, you can get a free account on gitlab. The main limitations for a free account on gitlab is that it’s only for open source projects (so viewable by everybody) and you have some data limits.

When you want to learn to apply git effectively, there is a bit of a learning curve ahead of you though.

So is the same software used on clients and servers?

Generally yes. When you clone a git repo, the full copy of the repo is populated in your workspace .git directory.

But typically on the “server” you run a wrapper around Git like Gitlab, Gitea, Github, etc that manages user access and provides a nice web UI to your Git repo on the server.

I highly recommend Gitlab for getting started. Their free tier is generous. If you want to run your own server, then use Gitea.

One other things to remember with Git – you should close KiCad before updating your local files (git pull).

1 Like

Some thoughts on collaboration and how Git fits into modern workflow:

https://handbook.tmpdir.org/

It works fairly well to store KiCad files in Git because they are a simple ASCII format with plenty of line feeds. So if two people modify the same library, it typically merges OK unless they modify the same part.

1 Like

Oh so I am back to confused again. Ideally we get it setup on our local server and on our machines. Maybe our IT people know more about git and can help as I can’t even install a program without them anyway.

Great an account and group (for your organization) at Gitlab, then create a repo in Gitlab.

If you are running Linux/MACOS, then just install git and use the git command line client.

If you are running windows, install:

Then in Windows explore, select the Tortoise Git clone option and use the URL from the Gitlab repo.

Now you can pull/push changes to the repo from your local workspace.

The advantage of hosting your repo on Gitlab is you can access from anywhere in the world and you don’t have to run your own Git server. Some don’t think this is secure enough, but if HTTPS is secure enough for your bank, it is probably secure enough for your design files.

If cloud hosting is not acceptable, then it is not hard to set up a Gitea server.

1 Like

This is only for component libraries at the moment, but really any business data should not be public.

It could make sense for project management but at the moment I think we are fine working on what we do and then copying the result and reworking it as a new revision.

VSCode might be another way to use Git if you want a GUI:

Gitlab and Github both offer free private repos, so there is really no cost/setup required to start using Git for commercial work. If you want to switch to an in-house server later, then push the repo to a different server and continue.

Even for personal work with no collaborators, I always use Git anymore as I get:

  • revision history – can roll back, view changes, etc.
  • branches – do exploratory work on branches and then merge when finished
  • backups – push, and my workspace is backed up to some machine far away in the cloud
  • easy sync between machines at any time in any location

…

It really is good once you get through the first 2 weeks of using it.