快速git

下载

bash 复制代码
sudo apt install git

配置

bash 复制代码
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
  • 没有空格可以不加双引号
  • 如果~/.ssh没有先创建(下一步用)

ssh方式制作密钥

github解释

bash 复制代码
#以邮箱作为标签或随意别的什么
 cd ~/.ssh
ssh-keygen -t ed25519 -C "your_email@example.com"
 ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

这里会让你输入密钥文件名和2次密码(用于克隆时候验证,或登录远程时会用)

bash 复制代码
cat *.pub

将公钥放入远程服务器端

编写配置文件(选一个或多个或自定义)

bash 复制代码
$ cat config
# GitHub
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github

# Gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitee

# Gitee
Host gitcode.com
HostName gitcode.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/gitcode

验证登陆:(***为你的账号名字)

bash 复制代码
$ ssh -T git@gitcode.com
remote: Welcome to GitCode, ***
bash 复制代码
$ ssh -T git@github.com
Hi ***! You've successfully authenticated, but GitHub does not provide shell access.
bash 复制代码
$ ssh -T git@gitee.com  
Hi **! You've successfully authenticated, but GITEE.COM does not provide shell access.
 
 验证登录后可以放心克隆
相关推荐
Sagittarius_A*2 小时前
Web 安全之 Git 泄露:原理剖析 + CTFHub Log/Stash/Index 全题型解法
git·安全·web安全
lazy H3 小时前
从入门到日常开发,一篇文章掌握 Git 核心操作
git·后端·学习·github
zzqssliu11 小时前
煤炉自动代拍系统的队列设计与超时控制机制
git·github
一支绝命钩11 小时前
FPGA工程Git常用操作手册
git
不搞学术柒柒15 小时前
Git新功能完整开发提交流程
git
午安~婉20 小时前
Git中SSH连接
前端·git·gitee
888CC++20 小时前
VS Code Git 工作树:解锁多分支并行开发新体验
git
阿虎儿20 小时前
Git exclude 功能解析
git
隔窗听雨眠1 天前
VS Code Git工作树:多分支并行开发的完整实践方案
git
^yi1 天前
【Linux系统编程】快速上手git仓库管理,核心三板斧
git