快速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.
 
 验证登录后可以放心克隆
相关推荐
刺客xs14 小时前
git 入门常用命令
大数据·git·elasticsearch
LostSpeed15 小时前
git - github工程中不能包含大文件
git·github
pzx_00115 小时前
【GIT】删除远程文件
git
小白_ysf16 小时前
Git 命令操作完整指南(实际工作中常用命令)
git·代码上传
HealthScience16 小时前
怎么使用git下载huggingface的文件
git
huangjiazhi_17 小时前
git clone next InitializeSecurityContext failed错误
git
_oP_i18 小时前
git gui设置github sshkey
git·github
ergevv18 小时前
Git 子模块(Submodule)操作指南
git·子模块·submodule
阿拉伯柠檬20 小时前
Git原理与使用(一)
大数据·linux·git·elasticsearch·面试
chao_78920 小时前
双设备全栈开发最佳实践[mac系统]
git·python·macos·docker·vue·全栈