CentOS 安装Github

一、首先安装git,注意,使用管理员权限(su)

# yum install git

二、然后,生成SSH key,下面命令中的“yourname@youremail.com"替换成github注册的邮箱

ssh-keygen -t rsa -b 4096 -C "yourname@youremail.com"

三次回车(如果希望使用密码,则在第二次第三次回车前输入密码,通常不用输入密码)。

Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.

系统会提示在/root/.ssh目录下生成了id_rsa.和is_rsa.pub两个文件,这就算存储密钥的私有及公有key文件。
三、将生成的SSH key添加到SSH-agent
Before adding a new SSH key to the ssh-agent to manage your keys, you should have checked for existing SSH keys and generated a new SSH key.
Start the ssh-agent in the background.

# eval "$(ssh-agent -s)"
> Agent pid 59566

Add your SSH private key to the ssh-agent. If you created your key with a different name, or if you are adding an existing key that has a different name, replace id_rsa in the command with the name of your private key file.

$ ssh-add ~/.ssh/id_rsa

五、复制SSH key
vim或者cat,然后复制,或者利用linuxclip工具
Downloads and installs xclip. If you don’t have apt-get, you might need to use another installer (like yum)

$ yum install xclip
$ xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

下面就是去github网站,填写SSH key。
In the upper-right corner of any page, click your profile photo, then click Settings.
Settings icon in the user bar

In the user settings sidebar, click SSH and GPG keys.
Authentication keys

Click New SSH key or Add SSH key.在这里插入图片描述

In the “Title” field, add a descriptive label for the new key. For example, if you’re using a personal Mac, you might call this key “Personal MacBook Air”.

Paste your key into the “Key” field.
The key field

Click Add SSH key.

The Add key button
If prompted, confirm your GitHub password.
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

steventian72

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值