安装git
apt-get install git
查看git 版本
git version
配置ssh
git config –global user.name “xxxxxx”
git config –global user.email “xxxxxx@163.com”
命令 git config –list,查看是否设置成功。
生成ssh
ssh-keygen -C ‘xxxxxx@163.com’ -t rsa
一直回车(中途选择不输入密码)
(me is data)
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:XHfnbJG0ZBDx8LG9PoDI5flB2M1UvprGG+GvjJ3y4u8 xxx@163.com
The key’s randomart image is:
这返回来到显示数据放在根目录下来然后去根目录下找(每个人也许返回到位置都不一样呢)
到/root/.ssh下 copy id_rsa.pub
cd /root/.ssh
ls -a 显示隐藏文件
gedit id_rsa.pub
copy出data
进入你自己的github,进入Settings->SSH and GPG keys->New SSH key,然后在Key那
操作命令
zhou@zhou-Lenovo-Z480:~$ git version
git version 2.7.4
zhou@zhou-Lenovo-Z480:~$ ssh -T git@github.com
Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.
Permission denied (publickey).
zhou@zhou-Lenovo-Z480:~$ git config --global user.name "zhouchenhua"
zhou@zhou-Lenovo-Z480:~$ git config --global user.email "noatnu@163.com"
zhou@zhou-Lenovo-Z480:~$ git config --list
user.name=zhouchenhua
user.email=noatnu@163.com
zhou@zhou-Lenovo-Z480:~$ ssh-keygen -C ‘noatnu@163.com’ -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zhou/.ssh/id_rsa): america347191
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in america347191.
Your public key has been saved in america347191.pub.
The key fingerprint is:
SHA256:7WlMe5QL3eMrdG6b7BB/z66zSpwIOBRM0GTD4hK6BW4 ‘noatnu@163.com’
The key's randomart image is:
+---[RSA 2048]----+
| .B* |
|. . ..+o |
|.o o .. |
|.Eo .. . . . o |
|.o . o S + = o |
|. . = B.*.. |
| B.Boo .|
| . o.o+=.|
| .=O*+|
+----[SHA256]-----+
root@zhou-Lenovo-Z480:/home/zhou# cd ~/.ssh
root@zhou-Lenovo-Z480:~/.ssh# ls -a
. .. id_rsa id_rsa.pub
root@zhou-Lenovo-Z480:~/.ssh# gedit id_rsa.pub
网友评论