快速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.
 
 验证登录后可以放心克隆
相关推荐
相与还3 小时前
IDEA和GIT实现cherry pick拣选部分变更到新分支
git·elasticsearch·intellij-idea
刘志辉10 小时前
git指令
git
2501_9167665413 小时前
【Git学习】初识git:简单介绍及安装流程
git·学习
孤独的追光者16 小时前
Git 完整流程:从暂存到推送
git
平平无奇。。。16 小时前
版本控制器之Git理论与实战
linux·git·gitee·github
这周也會开心1 天前
Git介绍和使用
git
小龙报1 天前
《彻底理解C语言指针全攻略(3)》
c语言·开发语言·windows·git·创业创新·学习方法·visual studio
前端备忘录1 天前
创建好git项目仓库后如何将本地项目传上去
git
代码or搬砖2 天前
Git学习笔记(二)
笔记·git·学习
sineiy2 天前
git使用教程
git