Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs working branch for the October 2024 release #671

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Sourcegraph Docs

<!-- Working branch for September 2024 Release -->
<!-- Working branch for October 2024 Release -->

Welcome to the Sourcegraph documentation! We're excited to have you contribute to our docs. We've recently rearchitectured our docs tech stack — powered by Next.js, TailwindCSS and deployed on Vercel. This guide will walk you through the process of contributing to our documentation using the new tech stack.

Expand Down
18 changes: 18 additions & 0 deletions docs/admin/code_hosts/aws_codecommit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,24 @@ To add CodeCommit repositories in Docker Container:
1. Follow the rest of the steps detailed in the [AWS SSH setup guide](https://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-ssh-unixes.html) to make sure you can connect to the code host locally.
1. Confirm you have the connection by running the following ssh command locally: `ssh git-codecommit.us-west-1.amazonaws.com` (Update link with your server region)
1. Confirm you can clone the repository locally.

### Configuring SSH credentials in the Web UI

```json
{
"gitURLType": "ssh",
"gitSSHKeyID": "<SSH key ID>",
"gitSSHCredential": {
// make sure the key is base64 encoded
// $ cat ~/.ssh/id_rsa | base64
"privateKey": "<base64 encoded of the SSH private key>",
"passphrase": "<passphrase if applicable, omit if none is needed>"
}
}
```

### Mounting SSH keys into the container

1. Copy all the files at your `$HOME/.ssh directory` to `$HOME/.sourcegraph/config/ssh` directory. See [docs](/admin/deploy/docker-single-container/#ssh-authentication-config-keys-knownhosts) for more information about our ssh file system.
1. Read our [guide here](/admin/deploy/docker-compose/#git-ssh-configuration) for Docker Compose deployments
1. Read our [guide here](/admin/deploy/kubernetes/configure#ssh-for-cloning) for Kubernetes deployments
Expand Down
37 changes: 34 additions & 3 deletions docs/admin/repo/auth.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,47 @@ If authentication (HTTP(S) or SSH) is required to `git clone` a repository then

First, ensure your **Site admin > Manage code hosts** code host configuration is configured to use SSH. For example, by setting the `gitURLType` field to "ssh". Alternatively, you may use the "Generic Git host" code host type, which allows you to directly specify Git repository URLs for cloning.

Then, follow the directions below depending on your deployment type:
Then, you need to supply the SSH keys and passphrase to Sourcegraph if applicable. You have two options:

- **Option 1**: Configure the SSH credentials in code host configuration in the Web UI. (Recommended)
- **Option 2**: Mount the SSH keys into the container.

## Configuring SSH credentials in the Web UI (Recommended)

In supported code hosts configuration, you can provide the credentials in the JSON configuration. For example:

```json
{
"url": "https://github.com",
"token": "<personal access token>",
"gitURLType": "ssh",
"gitSSHCredential": {
// make sure the key is base64 encoded
// $ cat ~/.ssh/id_rsa | base64
"privateKey": "<base64 encoded of the SSH private key>",
"passphrase": "<passphrase if applicable, omit if none is needed>"
}
}
```

Some providers may require additional configuration, consult the [code host specific documentation](/admin/code_hosts/) for more information.

## Mounting SSH keys into the container

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

>NOTE: Repository access over SSH is not yet supported on [Sourcegraph Cloud](/cloud/).

## Troubleshooting

### Error: `illegal base64 data at input byte 0`

This error indicates that the provided private key is not base64-encoded. Ensure that the private key is base64-encoded before providing it to Sourcegraph.

```bash
cat ~/.ssh/id_rsa | base64
```

### What should be included in my config file?

We recommend adding the `StrictHostKeyChecking no` and `AddKeysToAgent yes` flags to prevent the need to give permission interactively when cloning from a new host.
Expand Down
Loading