快速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.
 
 验证登录后可以放心克隆
相关推荐
CaptainDrake1 小时前
Git 原理(提交对象)(结合图与案例)
git
CaptainDrake1 小时前
Git:Git管理
git
PassLink_2 小时前
常用 Git 命令
git
想和我重名?3 小时前
Git的基本操作
git
慕羽★15 小时前
Git常用指令整理【新手入门级】【by慕羽】
linux·git·ubuntu·gitlab·github·仓库·分布式协作
鸡c15 小时前
etcd二次封装
git·github·etcd
救救孩子把15 小时前
UGit:腾讯自研的Git客户端新宠
java·开发语言·git
星叔16 小时前
git 压栈存储当前分支修改,出栈使用保存
git
狼魂豹速18 小时前
idea2024 Safe Mode解决、配置git出现Can‘t run a Git command in the safe mode、取消受信任项目功能
git
DN金猿21 小时前
git 问题 --- fatal: detected dubious ownership in repository at
git