Services
Configure Git-Tool to talk to any Git hosting service you want.
Git Tool has been written to support a wide range of Git servers and allows you to add your own via the config file. This enables you to interact with most common hosted Git services as well as your own on-premise ones.
The quickest way to add services to your config is to use the gt config add command to install services from the registry. If your service isn't there already, feel free to add it by following the contribution guide.
Here is an example service configuration for GitHub which showcases how to
1
services:
2
- domain: github.com
3
website: "https://{{ .Service.Domain }}/{{ .Repo.FullName }}"
4
httpUrl: "https://{{ .Service.Domain }}/{{ .Repo.FullName }}.git"
5
gitUrl: "[email protected]{{ .Service.Domain }}:{{ .Repo.FullName }}.git"
6
pattern: "*/*"
Copied!

Configuration

Git-Tool supports templates in both the service and app definitions. These can be used to access information about the repository that is being targeted by a given command.

domain

The domain is the unique identifier for this service and will always be the top-level directory name below which this service's repositories will be stored.
1
domain: github.com
Copied!

website

The website property configures the template which is used to generate URLs for a repository's website view. You should use either .Repo.FullName or a combination of .Repo.Namespace and .Repo.Name to build the URL.
1
website: "https://github.com/{{ .Repo.Namespace }}/{{ .Repo.Name }}"
Copied!
You can use .Service.Domain to access the domain field for the current service, making it easier to copy-paste service definitions for similar services running on different domains (like GitHub Enterprise and Gitea).

gitUrl

The gitUrl property is used to generate the GIT+SSH URL used by git to access this repository. It will be configured as the origin remote on newly created repositories and used to git clone existing repositories. If you need to fix an error with this, you can use the gt fix command to help you out.
1
gitUrl: "[email protected]:{{ .Repo.Namespace }}/{{ .Repo.Name }}.git"
Copied!

httpUrl

The httpUrl property is used to generate the HTTPS URL used by git to access this repository. It will be used if you set the http_transport feature flag to true.
1
httpUrl: "https://github.com/{{ .Repo.Namespace }}/{{ .Repo.Name }}.git"
Copied!

pattern

This is a pseudo-glob pattern used by Git-Tool to describe the depth of the directory structure at which repositories can be found. A pattern of */* implies that repositories can be found at the second level of directories within the github.com root. In some cases, services may have three (*/*/*) or more levels of nesting.
1
pattern: "*/*"
Copied!
Last modified 20d ago