- GitLab Cookbook
- Jeroen van Baarsen
- 346字
- 2021-08-05 16:55:06
Adding your SSH key to GitLab
In order for GitLab to know who we are and check whether we are authorized to commit certain code, we use our SSH key. The combination of the public key and the private key can tell GitLab that we are authorized, and GitLab will allow the operation to be performed.
How to do it…
To set up your SSH key, perform the following steps:
- Open GitLab and go to your account settings.
- Click on SSH.
- Click on Add SSH Key.
- To get information about your SSH key, enter the following command in your terminal. If you're using Windows, go to step 7:
$ cat ~/.ssh/id_rsa.pub
- You should copy the entire content of the output in step 4, as shown in the following screenshot:
- If you're not using Windows, you can move to step 11.
- Open the Windows explorer and move to
C:\Users\your_username\.ssh
. - Right-click on id_rsa.pub and click on Open.
- When asked for the program you want to use, select Notepad.
- Select the entire content of the file that contains the SSH key.
- We now paste the content of the SSH key into the form in your GitLab instance. You can name the SSH key anything you want. It is recommended that you name it after the computer it came from. This way, it will be easier to know which key belongs to which machine. If you leave the name field empty, GitLab will generate a name for you.
- Now, click on Add Key.
How it works…
In order to make Git aware of your SSH key, you need to add the public portion of the key to GitLab. When you add the SSH key to GitLab, it will put the key for the Git user in the authorized_keys
file on the GitLab server.
Whenever you will execute a Git command that will communicate with GitLab, it will check the permissions you have against your own user account.
One thing to remember is that you can only use one SSH key for one account, as it will be account-bound.
- Instant Testing with CasperJS
- Dynamics 365 Application Development
- iOS 9 Game Development Essentials
- JavaScript+jQuery網(wǎng)頁特效設(shè)計(jì)任務(wù)驅(qū)動(dòng)教程(第2版)
- C語言程序設(shè)計(jì)教程(第2版)
- Learning AWS Lumberyard Game Development
- Ray分布式機(jī)器學(xué)習(xí):利用Ray進(jìn)行大模型的數(shù)據(jù)處理、訓(xùn)練、推理和部署
- Java設(shè)計(jì)模式及實(shí)踐
- Learning ArcGIS for Desktop
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)實(shí)踐教程
- 編程與類型系統(tǒng)
- Processing創(chuàng)意編程指南
- Webpack實(shí)戰(zhàn):入門、進(jìn)階與調(diào)優(yōu)(第2版)
- 微信小程序開發(fā)實(shí)戰(zhàn):設(shè)計(jì)·運(yùn)營·變現(xiàn)(圖解案例版)
- Java Web開發(fā)實(shí)例大全(基礎(chǔ)卷) (軟件工程師開發(fā)大系)