diff options
Diffstat (limited to 'doc/ssh/README.md')
-rw-r--r-- | doc/ssh/README.md | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/doc/ssh/README.md b/doc/ssh/README.md index e570627bfc1..9c4a391e8da 100644 --- a/doc/ssh/README.md +++ b/doc/ssh/README.md @@ -19,7 +19,7 @@ comes pre-installed on GNU/Linux and macOS, but not on Windows. Depending on your Windows version, there are different methods to work with SSH keys. -### Installing the SSH client for Windows 10 +### Windows 10: Windows Subsystem for Linux Starting with Windows 10, you can [install the Windows Subsystem for Linux (WSL)](https://docs.microsoft.com/en-us/windows/wsl/install-win10) @@ -27,10 +27,10 @@ where you can run Linux distributions directly on Windows, without the overhead of a virtual machine. Once installed and set up, you'll have the Git and SSH clients at your disposal. -### Installing the SSH client for Windows 8.1 and Windows 7 +### Windows 10, 8.1, and 7: Git for Windows The easiest way to install Git and the SSH client on Windows 8.1 and Windows 7 -is [Git for Windows](https://gitforwindows.org). It provides a BASH +is [Git for Windows](https://gitforwindows.org). It provides a Bash emulation (Git Bash) used for running Git from the command line and the `ssh-keygen` command that is useful to create SSH keys as you'll learn below. @@ -114,7 +114,8 @@ To create a new SSH key pair: and want to tell which is which. It is optional. 1. Next, you will be prompted to input a file path to save your SSH key pair to. - If you don't already have an SSH key pair, use the suggested path by pressing + If you don't already have an SSH key pair and aren't generating a [deploy key](#deploy-keys), + use the suggested path by pressing <kbd>Enter</kbd>. Using the suggested path will normally allow your SSH client to automatically use the SSH key pair with no additional configuration. @@ -128,7 +129,7 @@ To create a new SSH key pair: <kbd>Enter</kbd> twice. If, in any case, you want to add or change the password of your SSH key pair, - you can use the `-p`flag: + you can use the `-p` flag: ``` ssh-keygen -p -o -f <keyname> @@ -246,6 +247,17 @@ Public SSH keys need to be unique to GitLab, as they will bind to your account. Your SSH key is the only identifier you'll have when pushing code via SSH, that's why it needs to uniquely map to a single user. +## Per-repository SSH keys + +If you want to use different keys depending on the repository you are working +on, you can issue the following command while inside your repository: + +```sh +git config core.sshCommand "ssh -o IdentitiesOnly=yes -i ~/.ssh/private-key-filename-for-this-repository -F /dev/null" +``` + +This will not use the SSH Agent and requires at least Git 2.10. + ## Deploy keys ### Per-repository deploy keys @@ -258,7 +270,8 @@ Integration (CI) server. By using deploy keys, you don't have to set up a dummy user account. If you are a project maintainer or owner, you can add a deploy key in the -project settings under the section 'Repository'. Specify a title for the new +project's **Settings > Repository** page by expanding the +**Deploy Keys** section. Specify a title for the new deploy key and paste a public SSH key. After this, the machine that uses the corresponding private SSH key has read-only or read-write (if enabled) access to the project. @@ -300,8 +313,8 @@ of broader usage for something like "Anywhere you need to give read access to your repository". Once a GitLab administrator adds the Global Deployment key, project maintainers -and owners can add it in project's **Settings > Repository** section by expanding the -**Deploy Key** section and clicking **Enable** next to the appropriate key listed +and owners can add it in project's **Settings > Repository** page by expanding the +**Deploy Keys** section and clicking **Enable** next to the appropriate key listed under **Public deploy keys available to any project**. NOTE: **Note:** @@ -318,7 +331,7 @@ not implicitly give any access just by setting them up. ### Eclipse -How to add your SSH key to Eclipse: https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration +How to add your SSH key to Eclipse: <https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration> ## SSH on the GitLab server |