mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-04-29 11:48:52 +00:00
365 lines
27 KiB
Text
365 lines
27 KiB
Text
<!DOCTYPE html>
|
|
|
|
<html class="" lang="en">
|
|
<head prefix="og: http://ogp.me/ns#">
|
|
<meta charset="utf-8"/>
|
|
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
|
|
<meta content="object" property="og:type"/>
|
|
<meta content="GitLab" property="og:site_name"/>
|
|
<meta content="Readme · Ssh · Help" property="og:title"/>
|
|
<meta content="GitLab Community Edition" property="og:description"/>
|
|
<meta content="http://172.20.254.127/assets/gitlab_logo-7ae504fe4f68fdebb3c2034e36621930cd36ea87924c11ff65dbcb8ed50dca58.png" property="og:image"/>
|
|
<meta content="64" property="og:image:width"/>
|
|
<meta content="64" property="og:image:height"/>
|
|
<meta content="http://172.20.254.127/help/ssh/README.md" property="og:url"/>
|
|
<meta content="summary" property="twitter:card"/>
|
|
<meta content="Readme · Ssh · Help" property="twitter:title"/>
|
|
<meta content="GitLab Community Edition" property="twitter:description"/>
|
|
<meta content="http://172.20.254.127/assets/gitlab_logo-7ae504fe4f68fdebb3c2034e36621930cd36ea87924c11ff65dbcb8ed50dca58.png" property="twitter:image"/>
|
|
<title>Readme · Ssh · Help · GitLab</title>
|
|
<meta content="GitLab Community Edition" name="description"/>
|
|
<link data-original-href="/assets/favicon-7901bd695fb93edb07975966062049829afb56cf11511236e61bcf425070e36e.png" href="/assets/favicon-7901bd695fb93edb07975966062049829afb56cf11511236e61bcf425070e36e.png" id="favicon" rel="shortcut icon" type="image/png"/>
|
|
<link href="/assets/application-266f2bfa52ff531258d13c702895a14fd5994ca591fa2df7338da00ab18c99ac.css" media="all" rel="stylesheet"/>
|
|
<link href="/assets/print-c8ff536271f8974b8a9a5f75c0ca25d2b8c1dceb4cff3c01d1603862a0bdcbfc.css" media="print" rel="stylesheet"/>
|
|
<script>
|
|
//<![CDATA[
|
|
window.gon={};gon.api_version="v4";gon.default_avatar_url="http://172.20.254.127/assets/no_avatar-849f9c04a3a0d0cea2424ae97b27447dc64a7dbfae83c036c45b403392f0e8ba.png";gon.max_file_size=10;gon.asset_host=null;gon.webpack_public_path="/assets/webpack/";gon.relative_url_root="";gon.shortcuts_path="/help/shortcuts";gon.user_color_scheme="white";gon.gitlab_url="http://172.20.254.127";gon.revision="63daf37";gon.gitlab_logo="/assets/gitlab_logo-7ae504fe4f68fdebb3c2034e36621930cd36ea87924c11ff65dbcb8ed50dca58.png";gon.sprite_icons="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg";gon.sprite_file_icons="/assets/file_icons-7262fc6897e02f1ceaf8de43dc33afa5e4f9a2067f4f68ef77dcc87946575e9e.svg";gon.emoji_sprites_css_path="/assets/emoji_sprites-289eccffb1183c188b630297431be837765d9ff4aed6130cf738586fb307c170.css";gon.test_env=false;gon.suggested_label_colors=["#0033CC","#428BCA","#44AD8E","#A8D695","#5CB85C","#69D100","#004E00","#34495E","#7F8C8D","#A295D6","#5843AD","#8E44AD","#FFECDB","#AD4363","#D10069","#CC0033","#FF0000","#D9534F","#D1D100","#F0AD4E","#AD8D43"];
|
|
//]]>
|
|
</script>
|
|
<script defer="defer" src="/assets/webpack/runtime.9fcb75d4.bundle.js"></script>
|
|
<script defer="defer" src="/assets/webpack/main.a66b6c66.chunk.js"></script>
|
|
<script defer="defer" src="/assets/webpack/pages.help.show.c42c0700.chunk.js"></script>
|
|
<meta content="authenticity_token" name="csrf-param">
|
|
<meta content="cvKzaOeMh/QPiL0f0pBrY+PnOkHpZh/8monwVAhmEQuipaGSBefiKYPgZv1ajbDA/5Do/OZSNSzY/IP/dNtHcg==" name="csrf-token">
|
|
<meta content="origin-when-cross-origin" name="referrer"/>
|
|
<meta content="width=device-width, initial-scale=1, maximum-scale=1" name="viewport"/>
|
|
<meta content="#474D57" name="theme-color"/>
|
|
<link href="/assets/touch-icon-iphone-5a9cee0e8a51212e70b90c87c12f382c428870c0ff67d1eb034d884b78d2dae7.png" rel="apple-touch-icon" type="image/x-icon"/>
|
|
<link href="/assets/touch-icon-ipad-a6eec6aeb9da138e507593b464fdac213047e49d3093fc30e90d9a995df83ba3.png" rel="apple-touch-icon" sizes="76x76" type="image/x-icon"/>
|
|
<link href="/assets/touch-icon-iphone-retina-72e2aadf86513a56e050e7f0f2355deaa19cc17ed97bbe5147847f2748e5a3e3.png" rel="apple-touch-icon" sizes="120x120" type="image/x-icon"/>
|
|
<link href="/assets/touch-icon-ipad-retina-8ebe416f5313483d9c1bc772b5bbe03ecad52a54eba443e5215a22caed2a16a2.png" rel="apple-touch-icon" sizes="152x152" type="image/x-icon"/>
|
|
<link color="rgb(226, 67, 41)" href="/assets/logo-d36b5212042cebc89b96df4bf6ac24e43db316143e89926c0db839ff694d2de4.svg" rel="mask-icon"/>
|
|
<meta content="/assets/msapplication-tile-1196ec67452f618d39cdd85e2e3a542f76574c071051ae7effbfde01710eb17d.png" name="msapplication-TileImage"/>
|
|
<meta content="#30353E" name="msapplication-TileColor"/>
|
|
</meta></meta></head>
|
|
<body class="ui-indigo " data-group="" data-page="help:show" data-project="">
|
|
<header class="navbar navbar-gitlab qa-navbar navbar-expand-sm">
|
|
<a class="sr-only gl-accessibility" href="#content-body" tabindex="1">Skip to content</a>
|
|
<div class="container-fluid">
|
|
<div class="header-content">
|
|
<div class="title-container">
|
|
<h1 class="title">
|
|
<a href="/" id="logo" title="Dashboard"><svg class="tanuki-logo" height="24" viewbox="0 0 36 36" width="24">
|
|
<path class="tanuki-shape tanuki-left-ear" d="M2 14l9.38 9v-9l-4-12.28c-.205-.632-1.176-.632-1.38 0z" fill="#e24329"></path>
|
|
<path class="tanuki-shape tanuki-right-ear" d="M34 14l-9.38 9v-9l4-12.28c.205-.632 1.176-.632 1.38 0z" fill="#e24329"></path>
|
|
<path class="tanuki-shape tanuki-nose" d="M18,34.38 3,14 33,14 Z" fill="#e24329"></path>
|
|
<path class="tanuki-shape tanuki-left-eye" d="M18,34.38 11.38,14 2,14 6,25Z" fill="#fc6d26"></path>
|
|
<path class="tanuki-shape tanuki-right-eye" d="M18,34.38 24.62,14 34,14 30,25Z" fill="#fc6d26"></path>
|
|
<path class="tanuki-shape tanuki-left-cheek" d="M2 14L.1 20.16c-.18.565 0 1.2.5 1.56l17.42 12.66z" fill="#fca326"></path>
|
|
<path class="tanuki-shape tanuki-right-cheek" d="M34 14l1.9 6.16c.18.565 0 1.2-.5 1.56L18 34.38z" fill="#fca326"></path>
|
|
</svg>
|
|
<span class="logo-text d-none d-sm-block">
|
|
<svg viewbox="0 0 617 169" xmlns="http://www.w3.org/2000/svg"><path d="M315.26 2.97h-21.8l.1 162.5h88.3v-20.1h-66.5l-.1-142.4M465.89 136.95c-5.5 5.7-14.6 11.4-27 11.4-16.6 0-23.3-8.2-23.3-18.9 0-16.1 11.2-23.8 35-23.8 4.5 0 11.7.5 15.4 1.2v30.1h-.1m-22.6-98.5c-17.6 0-33.8 6.2-46.4 16.7l7.7 13.4c8.9-5.2 19.8-10.4 35.5-10.4 17.9 0 25.8 9.2 25.8 24.6v7.9c-3.5-.7-10.7-1.2-15.1-1.2-38.2 0-57.6 13.4-57.6 41.4 0 25.1 15.4 37.7 38.7 37.7 15.7 0 30.8-7.2 36-18.9l4 15.9h15.4v-83.2c-.1-26.3-11.5-43.9-44-43.9M557.63 149.1c-8.2 0-15.4-1-20.8-3.5V70.5c7.4-6.2 16.6-10.7 28.3-10.7 21.1 0 29.2 14.9 29.2 39 0 34.2-13.1 50.3-36.7 50.3m9.2-110.6c-19.5 0-30 13.3-30 13.3v-21l-.1-27.8h-21.3l.1 158.5c10.7 4.5 25.3 6.9 41.2 6.9 40.7 0 60.3-26 60.3-70.9-.1-35.5-18.2-59-50.2-59M77.9 20.6c19.3 0 31.8 6.4 39.9 12.9l9.4-16.3C114.5 6 97.3 0 78.9 0 32.5 0 0 28.3 0 85.4c0 59.8 35.1 83.1 75.2 83.1 20.1 0 37.2-4.7 48.4-9.4l-.5-63.9V75.1H63.6v20.1h38l.5 48.5c-5 2.5-13.6 4.5-25.3 4.5-32.2 0-53.8-20.3-53.8-63-.1-43.5 22.2-64.6 54.9-64.6M231.43 2.95h-21.3l.1 27.3v94.3c0 26.3 11.4 43.9 43.9 43.9 4.5 0 8.9-.4 13.1-1.2v-19.1c-3.1.5-6.4.7-9.9.7-17.9 0-25.8-9.2-25.8-24.6v-65h35.7v-17.8h-35.7l-.1-38.5M155.96 165.47h21.3v-124h-21.3v124M155.96 24.37h21.3V3.07h-21.3v21.3"></path></svg>
|
|
</span>
|
|
</a></h1>
|
|
<ul class="list-unstyled navbar-sub-nav">
|
|
<li class="home"><a class="dashboard-shortcuts-projects" href="/explore" title="Projects">Projects
|
|
</a></li><li class=""><a class="dashboard-shortcuts-groups" href="/explore/groups" title="Groups">Groups
|
|
</a></li><li class=""><a class="dashboard-shortcuts-snippets" href="/explore/snippets" title="Snippets">Snippets
|
|
</a></li><li>
|
|
<a href="/help" title="About GitLab CE">Help</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="navbar-collapse collapse">
|
|
<ul class="nav navbar-nav">
|
|
<li class="nav-item d-none d-sm-none d-md-block m-auto">
|
|
<div class="search search-form">
|
|
<form accept-charset="UTF-8" action="/search" class="form-inline" method="get"><input name="utf8" type="hidden" value="✓"/><div class="search-input-container">
|
|
<div class="search-input-wrap">
|
|
<div class="dropdown" data-url="/search/autocomplete">
|
|
<input aria-label="Search" autocomplete="off" class="search-input dropdown-menu-toggle no-outline js-search-dashboard-options" data-issues-path="/dashboard/issues" data-mr-path="/dashboard/merge_requests" id="search" name="search" placeholder="Search" spellcheck="false" tabindex="1" type="search"/>
|
|
<button class="hidden js-dropdown-search-toggle" data-toggle="dropdown" type="button"></button>
|
|
<div class="dropdown-menu dropdown-select">
|
|
<div class="dropdown-content"><ul>
|
|
<li class="dropdown-menu-empty-item">
|
|
<a>
|
|
Loading...
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</div><div class="dropdown-loading"><i aria-hidden="true" class="fa fa-spinner fa-spin" data-hidden="true"></i></div>
|
|
</div>
|
|
<svg class="s16 search-icon"><use xlink:href="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg#search"></use></svg>
|
|
<svg class="s16 clear-icon js-clear-input"><use xlink:href="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg#close"></use></svg>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<input class="js-search-group-options" id="group_id" name="group_id" type="hidden"/>
|
|
<input class="js-search-project-options" id="search_project_id" name="project_id" type="hidden" value=""/>
|
|
<input id="repository_ref" name="repository_ref" type="hidden"/>
|
|
<div class="search-autocomplete-opts hide" data-autocomplete-path="/search/autocomplete"></div>
|
|
</form></div>
|
|
</li>
|
|
<li class="nav-item d-inline-block d-sm-none d-md-none">
|
|
<a aria-label="Search" data-container="body" data-placement="bottom" data-toggle="tooltip" href="/search" title="Search"><svg class="s16"><use xlink:href="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg#search"></use></svg>
|
|
</a></li>
|
|
<li class="nav-item">
|
|
<div>
|
|
<a class="btn btn-sign-in" href="/users/sign_in?redirect_to_referer=yes">Sign in / Register</a>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<button class="navbar-toggler d-block d-sm-none" type="button">
|
|
<span class="sr-only">Toggle navigation</span>
|
|
<svg class="s12 more-icon js-navbar-toggle-right"><use xlink:href="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg#more"></use></svg>
|
|
<svg class="s12 close-icon js-navbar-toggle-left"><use xlink:href="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg#close"></use></svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
<div class="layout-page">
|
|
<div class="content-wrapper">
|
|
<div class="mobile-overlay"></div>
|
|
<div class="alert-wrapper">
|
|
<nav class="breadcrumbs container-fluid container-limited" role="navigation">
|
|
<div class="breadcrumbs-container">
|
|
<div class="breadcrumbs-links js-title-container">
|
|
<ul class="list-unstyled breadcrumbs-list js-breadcrumbs-list">
|
|
<li><a href="/help">Help</a><svg class="s8 breadcrumbs-list-angle"><use xlink:href="/assets/icons-07542808fffaf82e9b57b144464ea42620b32f65ce441c01528d23d4b96d5f11.svg#angle-right"></use></svg></li>
|
|
<li>
|
|
<h2 class="breadcrumbs-sub-title"><a href="/help/ssh/README.md">Help</a></h2>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
<div class="flash-container flash-container-page">
|
|
</div>
|
|
</div>
|
|
<div class="container-fluid container-limited ">
|
|
<div class="content" id="content-body">
|
|
<div class="documentation wiki prepend-top-default">
|
|
<h1 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#gitlab-and-ssh-keys" id="user-content-gitlab-and-ssh-keys"></a>GitLab and SSH keys</h1>
|
|
<p dir="auto">Git is a distributed version control system, which means you can work locally
|
|
but you can also share or "push" your changes to other servers.
|
|
Before you can push your changes to a GitLab server
|
|
you need a secure communication channel for sharing information.</p>
|
|
<p dir="auto">The SSH protocol provides this security and allows you to authenticate to the
|
|
GitLab remote server without supplying your username or password each time.</p>
|
|
<p dir="auto">For a more detailed explanation of how the SSH protocol works, we advise you to
|
|
read <a href="https://www.digitalocean.com/community/tutorials/understanding-the-ssh-encryption-and-connection-process" rel="nofollow noreferrer noopener" target="_blank">this nice tutorial by DigitalOcean</a>.</p>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#locating-an-existing-ssh-key-pair" id="user-content-locating-an-existing-ssh-key-pair"></a>Locating an existing SSH key pair</h2>
|
|
<p dir="auto">Before generating a new SSH key pair check if your system already has one
|
|
at the default location by opening a shell, or Command Prompt on Windows,
|
|
and running the following command:</p>
|
|
<p dir="auto"><strong>Windows Command Prompt:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell"><span class="nb">type</span> %userprofile%<span class="se">\.</span>ssh<span class="se">\i</span>d_rsa.pub</span></code></pre>
|
|
<p dir="auto"><strong>Git Bash on Windows / GNU/Linux / macOS / PowerShell:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell"><span class="nb">cat</span> ~/.ssh/id_rsa.pub</span></code></pre>
|
|
<p dir="auto">If you see a string starting with <code>ssh-rsa</code> you already have an SSH key pair
|
|
and you can skip the generate portion of the next section and skip to the copy
|
|
to clipboard step.
|
|
If you don't see the string or would like to generate a SSH key pair with a
|
|
custom name continue onto the next step.</p>
|
|
<p dir="auto">Note that Public SSH key may also be named as follows:</p>
|
|
<ul dir="auto">
|
|
<li><code>id_dsa.pub</code></li>
|
|
<li><code>id_ecdsa.pub</code></li>
|
|
<li><code>id_ed25519.pub</code></li>
|
|
</ul>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#generating-a-new-ssh-key-pair" id="user-content-generating-a-new-ssh-key-pair"></a>Generating a new SSH key pair</h2>
|
|
<ol dir="auto">
|
|
<li>
|
|
<p>To generate a new SSH key pair, use the following command:</p>
|
|
<p><strong>Git Bash on Windows / GNU/Linux / macOS:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell">ssh-keygen <span class="nt">-t</span> rsa <span class="nt">-C</span> <span class="s2">"your.email@example.com"</span> <span class="nt">-b</span> 4096</span></code></pre>
|
|
<p><strong>Windows:</strong></p>
|
|
<p>Alternatively on Windows you can download
|
|
<a href="http://www.chiark.greenend.org.uk/%7Esgtatham/putty/download.html" rel="nofollow noreferrer noopener" target="_blank">PuttyGen</a>
|
|
and follow <a href="https://the.earth.li/%7Esgtatham/putty/0.67/htmldoc/Chapter8.html#pubkey-puttygen" rel="nofollow noreferrer noopener" target="_blank">this documentation article</a> to generate a SSH key pair.</p>
|
|
</li>
|
|
<li>
|
|
<p>Next, you will be prompted to input a file path to save your SSH key pair to.</p>
|
|
<p>If you don't already have an SSH key pair use the suggested path by pressing
|
|
enter. Using the suggested path will normally allow your SSH client
|
|
to automatically use the SSH key pair with no additional configuration.</p>
|
|
<p>If you already have a SSH key pair with the suggested file path, you will need
|
|
to input a new file path and declare what host this SSH key pair will be used
|
|
for in your <code>.ssh/config</code> file, see <a href="#working-with-non-default-ssh-key-pair-paths"><strong>Working with non-default SSH key pair paths</strong></a>
|
|
for more information.</p>
|
|
</li>
|
|
<li>
|
|
<p>Once you have input a file path you will be prompted to input a password to
|
|
secure your SSH key pair. It is a best practice to use a password for an SSH
|
|
key pair, but it is not required and you can skip creating a password by
|
|
pressing enter.</p>
|
|
<p>NOTE: <strong>Note:</strong>
|
|
If you want to change the password of your SSH key pair, you can use
|
|
<code>ssh-keygen -p <keyname></code>.</p>
|
|
</li>
|
|
<li>
|
|
<p>The next step is to copy the public SSH key as we will need it afterwards.</p>
|
|
<p>To copy your public SSH key to the clipboard, use the appropriate code below:</p>
|
|
<p><strong>macOS:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell">pbcopy < ~/.ssh/id_rsa.pub</span></code></pre>
|
|
<p><strong>GNU/Linux (requires the xclip package):</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell">xclip <span class="nt">-sel</span> clip < ~/.ssh/id_rsa.pub</span></code></pre>
|
|
<p><strong>Windows Command Line:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell"><span class="nb">type</span> %userprofile%<span class="se">\.</span>ssh<span class="se">\i</span>d_rsa.pub | clip</span></code></pre>
|
|
<p><strong>Git Bash on Windows / Windows PowerShell:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell"><span class="nb">cat</span> ~/.ssh/id_rsa.pub | clip</span></code></pre>
|
|
</li>
|
|
<li>
|
|
<p>The final step is to add your public SSH key to GitLab.</p>
|
|
<p>Navigate to the 'SSH Keys' tab in your 'Profile Settings'.
|
|
Paste your key in the 'Key' section and give it a relevant 'Title'.
|
|
Use an identifiable title like 'Work Laptop - Windows 7' or
|
|
'Home MacBook Pro 15'.</p>
|
|
<p>If you manually copied your public SSH key make sure you copied the entire
|
|
key starting with <code>ssh-rsa</code> and ending with your email.</p>
|
|
</li>
|
|
<li>
|
|
<p>Optionally you can test your setup by running <code>ssh -T git@example.com</code>
|
|
(replacing <code>example.com</code> with your GitLab domain) and verifying that you
|
|
receive a <code>Welcome to GitLab</code> message.</p>
|
|
</li>
|
|
</ol>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#working-with-non-default-ssh-key-pair-paths" id="user-content-working-with-non-default-ssh-key-pair-paths"></a>Working with non-default SSH key pair paths</h2>
|
|
<p dir="auto">If you used a non-default file path for your GitLab SSH key pair,
|
|
you must configure your SSH client to find your GitLab private SSH key
|
|
for connections to your GitLab server (perhaps <code>gitlab.com</code>).</p>
|
|
<p dir="auto">For your current terminal session you can do so using the following commands
|
|
(replacing <code>other_id_rsa</code> with your private SSH key):</p>
|
|
<p dir="auto"><strong>Git Bash on Windows / GNU/Linux / macOS:</strong></p>
|
|
<pre class="code highlight js-syntax-highlight shell" lang="shell" v-pre="true"><code><span class="line" id="LC1" lang="shell"><span class="nb">eval</span> <span class="k">$(</span>ssh-agent <span class="nt">-s</span><span class="k">)</span></span>
|
|
<span class="line" id="LC2" lang="shell">ssh-add ~/.ssh/other_id_rsa</span></code></pre>
|
|
<p dir="auto">To retain these settings you'll need to save them to a configuration file.
|
|
For OpenSSH clients this is configured in the <code>~/.ssh/config</code> file for some
|
|
operating systems.
|
|
Below are two example host configurations using their own SSH key:</p>
|
|
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span class="line" id="LC1" lang="plaintext"># GitLab.com server</span>
|
|
<span class="line" id="LC2" lang="plaintext">Host gitlab.com</span>
|
|
<span class="line" id="LC3" lang="plaintext">RSAAuthentication yes</span>
|
|
<span class="line" id="LC4" lang="plaintext">IdentityFile ~/.ssh/config/private-key-filename-01</span>
|
|
<span class="line" id="LC5" lang="plaintext"></span>
|
|
<span class="line" id="LC6" lang="plaintext"># Private GitLab server</span>
|
|
<span class="line" id="LC7" lang="plaintext">Host gitlab.company.com</span>
|
|
<span class="line" id="LC8" lang="plaintext">RSAAuthentication yes</span>
|
|
<span class="line" id="LC9" lang="plaintext">IdentityFile ~/.ssh/config/private-key-filename</span></code></pre>
|
|
<p dir="auto">Due to the wide variety of SSH clients and their very large number of
|
|
configuration options, further explanation of these topics is beyond the scope
|
|
of this document.</p>
|
|
<p dir="auto">Public SSH keys need to be unique, 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.</p>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#deploy-keys" id="user-content-deploy-keys"></a>Deploy keys</h2>
|
|
<h3 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#per-repository-deploy-keys" id="user-content-per-repository-deploy-keys"></a>Per-repository deploy keys</h3>
|
|
<p dir="auto">Deploy keys allow read-only or read-write (if enabled) access to one or
|
|
multiple projects with a single SSH key pair.</p>
|
|
<p dir="auto">This is really useful for cloning repositories to your Continuous
|
|
Integration (CI) server. By using deploy keys, you don't have to set up a
|
|
dummy user account.</p>
|
|
<p dir="auto">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
|
|
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.</p>
|
|
<p dir="auto">You can't add the same deploy key twice using the form.
|
|
If you want to add the same key to another project, please enable it in the
|
|
list that says 'Deploy keys from projects available to you'. All the deploy
|
|
keys of all the projects you have access to are available. This project
|
|
access can happen through being a direct member of the project, or through
|
|
a group.</p>
|
|
<p dir="auto">Deploy keys can be shared between projects, you just need to add them to each
|
|
project.</p>
|
|
<h3 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#global-shared-deploy-keys" id="user-content-global-shared-deploy-keys"></a>Global shared deploy keys</h3>
|
|
<p dir="auto">Global Shared Deploy keys allow read-only or read-write (if enabled) access to
|
|
be configured on any repository in the entire GitLab installation.</p>
|
|
<p dir="auto">This is really useful for integrating repositories to secured, shared Continuous
|
|
Integration (CI) services or other shared services.
|
|
GitLab administrators can set up the Global Shared Deploy key in GitLab and
|
|
add the private key to any shared systems. Individual repositories opt into
|
|
exposing their repository using these keys when a project maintainers (or higher)
|
|
authorizes a Global Shared Deploy key to be used with their project.</p>
|
|
<p dir="auto">Global Shared Keys can provide greater security compared to Per-Project Deploy
|
|
Keys since an administrator of the target integrated system is the only one
|
|
who needs to know and configure the private key.</p>
|
|
<p dir="auto">GitLab administrators set up Global Deploy keys in the Admin area under the
|
|
section <strong>Deploy Keys</strong>. Ensure keys have a meaningful title as that will be
|
|
the primary way for project maintainers and owners to identify the correct Global
|
|
Deploy key to add. For instance, if the key gives access to a SaaS CI instance,
|
|
use the name of that service in the key name if that is all it is used for.
|
|
When creating Global Shared Deploy keys, give some thought to the granularity
|
|
of keys - they could be of very narrow usage such as just a specific service or
|
|
of broader usage for something like "Anywhere you need to give read access to
|
|
your repository".</p>
|
|
<p dir="auto">Once a GitLab administrator adds the Global Deployment key, project maintainers
|
|
and owners can add it in project's <strong>Settings > Repository</strong> section by expanding the
|
|
<strong>Deploy Key</strong> section and clicking <strong>Enable</strong> next to the appropriate key listed
|
|
under <strong>Public deploy keys available to any project</strong>.</p>
|
|
<p dir="auto">NOTE: <strong>Note:</strong>
|
|
The heading <strong>Public deploy keys available to any project</strong> only appears
|
|
if there is at least one Global Deploy Key configured.</p>
|
|
<p dir="auto">CAUTION: <strong>Warning:</strong>
|
|
Defining Global Deploy Keys does not expose any given repository via
|
|
the key until that repository adds the Global Deploy Key to their project.
|
|
In this way the Global Deploy Keys enable access by other systems, but do
|
|
not implicitly give any access just by setting them up.</p>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#applications" id="user-content-applications"></a>Applications</h2>
|
|
<h3 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#eclipse" id="user-content-eclipse"></a>Eclipse</h3>
|
|
<p dir="auto">How to add your SSH key to Eclipse: <a href="https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration" rel="nofollow noreferrer noopener" target="_blank">https://wiki.eclipse.org/EGit/User_Guide#Eclipse_SSH_Configuration</a></p>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#ssh-on-the-gitlab-server" id="user-content-ssh-on-the-gitlab-server"></a>SSH on the GitLab server</h2>
|
|
<p dir="auto">GitLab integrates with the system-installed SSH daemon, designating a user
|
|
(typically named <code>git</code>) through which all access requests are handled. Users
|
|
connecting to the GitLab server over SSH are identified by their SSH key instead
|
|
of their username.</p>
|
|
<p dir="auto">SSH <em>client</em> operations performed on the GitLab server wil be executed as this
|
|
user. Although it is possible to modify the SSH configuration for this user to,
|
|
e.g., provide a private SSH key to authenticate these requests by, this practice
|
|
is <strong>not supported</strong> and is strongly discouraged as it presents significant
|
|
security risks.</p>
|
|
<p dir="auto">The GitLab check process includes a check for this condition, and will direct you
|
|
to this section if your server is configured like this, e.g.:</p>
|
|
<pre class="code highlight js-syntax-highlight plaintext" lang="plaintext" v-pre="true"><code><span class="line" id="LC1" lang="plaintext">$ gitlab-rake gitlab:check</span>
|
|
<span class="line" id="LC2" lang="plaintext"># ...</span>
|
|
<span class="line" id="LC3" lang="plaintext">Git user has default SSH configuration? ... no</span>
|
|
<span class="line" id="LC4" lang="plaintext"> Try fixing it:</span>
|
|
<span class="line" id="LC5" lang="plaintext"> mkdir ~/gitlab-check-backup-1504540051</span>
|
|
<span class="line" id="LC6" lang="plaintext"> sudo mv /var/lib/git/.ssh/id_rsa ~/gitlab-check-backup-1504540051</span>
|
|
<span class="line" id="LC7" lang="plaintext"> sudo mv /var/lib/git/.ssh/id_rsa.pub ~/gitlab-check-backup-1504540051</span>
|
|
<span class="line" id="LC8" lang="plaintext"> For more information see:</span>
|
|
<span class="line" id="LC9" lang="plaintext"> doc/ssh/README.md in section "SSH on the GitLab server"</span>
|
|
<span class="line" id="LC10" lang="plaintext"> Please fix the error above and rerun the checks.</span></code></pre>
|
|
<p dir="auto">Remove the custom configuration as soon as you're able to. These customizations
|
|
are <em>explicitly not supported</em> and may stop working at any time.</p>
|
|
<h2 dir="auto">
|
|
<a aria-hidden="true" class="anchor" href="#troubleshooting" id="user-content-troubleshooting"></a>Troubleshooting</h2>
|
|
<p dir="auto">If on Git clone you are prompted for a password like <code>git@gitlab.com's password:</code>
|
|
something is wrong with your SSH setup.</p>
|
|
<ul dir="auto">
|
|
<li>Ensure that you generated your SSH key pair correctly and added the public SSH
|
|
key to your GitLab profile</li>
|
|
<li>Try manually registering your private SSH key using <code>ssh-agent</code> as documented
|
|
earlier in this document</li>
|
|
<li>Try to debug the connection by running <code>ssh -Tv git@example.com</code>
|
|
(replacing <code>example.com</code> with your GitLab domain)</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|