Mryqu's Notes


  • 首页

  • 搜索
close

SSH keys for Git System

时间: 2013-09-18   |   分类: Tool   Git     |   阅读: 375 字 ~2分钟

SSH keys

An SSH key allows you to establish a secure connection betweenyour computer and Git system such as GitHub, GitLab. Before generating an SSH key, check if your system already hasone by running cat ~/.ssh/id_rsa.pub . If you see a long string startingwith ssh-rsa or ssh-dsa ,you can skip the ssh-keygen step. To generate a new SSH key, just open your terminal and use codebelow. The ssh-keygen command prompts you for a location andfilename to store the key pair and for a password. When promptedfor the location and filename, you can press enter to use thedefault. It is a best practice to use a password for an SSH key, but itis not required and you can skip creating a password by pressingenter. Note that the password you choose here can’t be altered orretrieved.

ssh-keygen -t rsa -C "quyandong@yahoo.com"

Use the code below to show your public key.

cat ~/.ssh/id_rsa.pub

Copy-paste the key to the ‘My SSH Keys’ section under the ‘SSH’tab in your user profile. Please copy the complete key startingwith ssh- andending with your username and host.

Use code below to copy your public key to the clipboard.Depending on your OS you’ll need to use a different command:

Windows:

clip < ~/.ssh/id_rsa.pub

Mac:

pbcopy < ~/.ssh/id_rsa.pub

Linux (requires xclip):

xclip -sel clip < ~/.ssh/id_rsa.pub

Deploy keys

Deploy keys allow read-only access to multiple projects with asingle SSH key. This is really useful for cloning repositories to yourContinuous Integration (CI) server. By using deploy keys, you don’thave to setup a dummy user account. If you are a project master or owner, you can add a deploy keyin the project settings under the section ‘Deploy Keys’. Press the’New Deploy Key’ button and upload a public SSH key. After this,the machine that uses the corresponding private key has read-onlyaccess to the project. You can’t add the same deploy key twice with the ‘New DeployKey’ option. If you want to add the same key to another project,please enable it in the list that says ‘Deploy keys from projectsavailable to you’. All the deploy keys of all the projects you haveaccess to are available. This project access can happen throughbeing a direct member of the projecti, or through a group. See def accessible_deploy_keys in app/models/user.rb for more information.

标题:SSH keys for Git System
作者:mryqu
声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 CN 许可协议。转载请注明出处!

#ssh# #key# #git# #github# #gitlab#
Python安装oauth2库
尝试Apache Avro支持的各种数据类型
  • 文章目录
  • 站点概览

Programmer & Architect

662 日志
27 分类
1472 标签
GitHub Twitter FB Page
  • SSH keys
  • Deploy keys
© 2009 - 2023 Mryqu's Notes
Powered by - Hugo v0.120.4
Theme by - NexT
0%