快速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.
 
 验证登录后可以放心克隆
相关推荐
Zhichao_971 分钟前
VSCode+AI操作Git、GitHub
git·github
EchoMind-Henry4 分钟前
Anthropic自建Git替代品,先看替换了什么
git
墨云安全2 小时前
自动化渗透测试工具有哪些?2026 年引擎原理、任务编排与误报抑制实践
git·测试工具·网络安全·渗透测试·自动化
-恰饭第一名-3 小时前
Codex 任务上下文整理:事实清单、只读检查与开场模板
git
打盹的小pig12 小时前
git pull 报错
git
Tairitsu_H1 天前
[版本控制器Git] Git 远程仓库 | 多人协作 | 企业级 Git Flow 开发模型
git·版本控制器·远程仓库
我先去打把游戏先1 天前
Git-Rebase使用指南-从原理到实战
服务器·git·嵌入式硬件·物联网·ubuntu
kaixin_learn_qt_ing1 天前
我有两个程序,它们在不同的项目中,但是它们复用了一部分头文件,它们在两个不同的git仓库中,有什么好的办法可以让它们复用吗?
git
greatofdream1 天前
git rebase时如何解决merge节点冲突问题
大数据·git·elasticsearch
敲敲敲-敲代码2 天前
git安装记录
git