# Services

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

services:
  - domain: github.com
    website: "https://{{ .Service.Domain }}/{{ .Repo.FullName }}"
    httpUrl: "https://{{ .Service.Domain }}/{{ .Repo.FullName }}.git"
    gitUrl: "[email protected]{{ .Service.Domain }}:{{ .Repo.FullName }}.git"
    pattern: "*/*"
1
2
3
4
5
6

# Configuration

TIP

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 required

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.

domain: github.com
1

# website required

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.

website: "https://github.com/{{ .Repo.Namespace }}/{{ .Repo.Name }}"
1

TIP

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 required

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.

gitUrl: "[email protected]:{{ .Repo.Namespace }}/{{ .Repo.Name }}.git"
1

# httpUrl required

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.

httpUrl: "https://github.com/{{ .Repo.Namespace }}/{{ .Repo.Name }}.git"
1

# pattern required

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.

pattern: "*/*"
1