0
点赞
收藏
分享

微信扫一扫

Mac安装Git

官网

https://git-scm.com/download/mac

brew安装git

brew install git

Mac安装Git_电子邮件地址

配置git

设置Git用户名和电子邮件:

#设置你的用户名
git config --global user.name "你的用户名"
#设置你的电子邮件地址
git config --global user.email "你的电子邮件地址"

#检查配置
git config --list

Mac安装Git_电子邮件地址_02

生成 SSH 密钥

#生成新的 SSH 密钥
ssh-keygen -t rsa -b 4096 -C "你的电子邮件地址"

Mac安装Git_电子邮件地址_03

添加 SSH 密钥到 ssh-agent:

#启动 ssh-agent
eval "$(ssh-agent -s)"
#将 SSH 私钥添加到 ssh-agent
ssh-add -K ~/.ssh/id_rsa

Mac安装Git_用户名_04

将 SSH 密钥添加到 Git 服务器

#复制 SSH 公钥到剪贴板
pbcopy < ~/.ssh/id_rsa.pub

Mac安装Git_用户名_05

登录到Git 服务器账户,找到添加新 SSH 密钥的地方Settings/Developer Settings,粘贴并保存。

Mac安装Git_git_06


Mac安装Git_git_07

测试git命令连接github

ssh -T git@github.com

Mac安装Git_用户名_08

Mac安装Git_git_09




举报

相关推荐

0 条评论