# Custom git config

Sourcegraph supports customising [git-config](https://git-scm.com/docs/git-config) and [ssh_config](https://linux.die.net/man/5/ssh_config) for adjusting the behaviour of git. Sourcegraph will read these from the standard locations.

This guide documents how to configure git-config. To set up SSH and authentication for repositories, see [Repository authentication](/admin/repo/auth).

-   [Sourcegraph with Docker Compose](/self-hosted/deploy/docker-compose/): See [the Docker Compose git configuration guide](/self-hosted/deploy/docker-compose/#git-configuration).
-   [Sourcegraph with Kubernetes](/self-hosted/deploy/kubernetes/): See [Configure repository cloning via SSH](/self-hosted/deploy/kubernetes/configure#ssh-for-cloning).
-   [Single-container Sourcegraph](/self-hosted/deploy/docker-single-container/): See [the single-container git configuration guide](/self-hosted/deploy/docker-single-container/#git-configuration-and-authentication).

## Example: alternate clone URL for repos

Some sites put an HTTPS or SSH proxy in front of their code host to reduce load. Some sites also use a service like AWS CodeCommit to do the same. In these cases, the repos still should be treated as being repos on the original code host, not the proxy site.

For example, I have a GitHub repo `github.com/foo/bar`. I want Sourcegraph to clone it using the URL https://cloneproxy.example.com/foo/bar.git. But I still want the "Go to GitHub repository" button, etc., to take me to https://github.com/foo/bar. You can use the git configuration [`insteadOf`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf):

```ini
# ~/.gitconfig or /etc/gitconfig
[url "https://cloneproxy.example.com"]
  insteadOf = https://github.com
```

If you are [cloning via SSH](/admin/repo/auth), you can also achieve this with an SSH configuration:

```
# ~/.ssh/config
Host github.com
  Hostname cloneproxy.example.com
```
