Linux 之 Git 配置
1. 安装 Git
sudo apt install git
2. 配置 用户名、邮箱、默认编辑工具
$ git config --global user.name "Github 用户名"
$ git config --global user.email "Github 登录邮箱"
$ git config --global core.editor "vim"
# 查看配置信息
$ git config --global -l
3. 创建版本库
# 在版本库文件夹内
$ git init
4. 连接远程仓库
$ ssh-keygen -t rsa -C "Github 登录邮箱"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/xklsm/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/xklsm/.ssh/id_rsa
Your public key has been saved in /home/xklsm/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:IVWXumAg9N3TBePFzA0nE1FoXPHM2lL4kYEl7Pm2doY 【Github登录邮箱】
The key‘s randomart image is:
+---[RSA 3072]----+
| .. ... =O@%=|
| ...o . +.*OB=|
| .o.o o.+.oo=|
| .o... o =.|
| .S. . + o|
| . + |
| ...|
| Eoo|
| ...|
+----[SHA256]-----+
5. 添加 public key 到 Github
# 拷贝 $HOME/.ssh/id_rsa.pub 文件中内容,并添加key到Github
Linux 之 Git 配置