Creating a new branchīefore you start coding on a new feature, you should make sure to keep your changes separate from the main branch. This clones the Matomo repository into a matomo directory, initialises all submodules and pulls all the screenshot testing files using LFS. You will always want to use SSH URLs when cloning a repository, for example clone a repository, use for example: git clone matomo Github supports cloning via HTTPS and SSH URLs. If you cloned the repository without having Git LFS installed then follow these instructions.
As often there is no right or wrong and not one way to do something. If you prefer using Git through your IDE like PHPStorm, or if you are more accustomed to use a slightly different commands or methods then please go with your preferred option of what you feel comfortable with. Below are some tips for using git along with a guide for how we work using git on the command line. You could even have multiple remotes at the same time, all working as expected.At Matomo we're using Git version control system. Additionally, they will make it easier to migrate your repositories to a different organization or Git host as you won't need to change the submodule configuration for that. They don't force all developers to use HTTPS or SSH leaving them the freedom of choice. I would recommend using relative submodule URLs whenever possible.
Update all modules from the now correct remote URL using the following command in the repository root (because it is called recursively on all submodules, even nested ones): git submodule update - init - recursive - remote gitmodules file (not necessarily the repository root if its submodules contain other nested submodules): git submodule sync This file gets committed to Git.įorce submodules to resynchronize with the modified file using the following command in the folder with the modified. The easiest way I found to do that is as follows: To fix the issue for me (and other SSH users) in repositories which already contain submodules with HTTPS URLs, I have to change the URL. or Usually all repositories in a project are at least hosted in the same service, so this technique can be used. mySubmodule.git example would work as long as the parent repository is in the same GitHub organization, e.g. This works for both HTTPS and SSH users because it uses the root repository URL as base onto which the relative path is applied. The solution is to use a relative URL instead:
Url = course, that would cause problems for HTTPS users. Git can handle that but requires you to authenticate over HTTPS, effectively using two different authentication methods for a single repository.įor an SSH user, a correct configuration would be the following: The issue with the above example for an SSH user is the absolute HTTPS path. Each submodule definition consists of a path inside the repository where the files from the submodule are placed and a URL of its repository, as in the following example: Git repositories with submodules are a different story, though. Fortunately, the way I connect to the repository usually doesn't matter, as all Git hosting services support both HTTPS and SSH.
I prefer using Git over SSH which makes me a minority in most teams I work with.