win10配置gitee和github

基础环境配置

git下载

https://git-scm.com/downloads

git配置

https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration
完成git的安装之后,点击Git Bash Here,进入git命令终端。
win10 git bash
输入如下命令配置用户名以及邮箱

# 修改用户名
$ git config --global user.name "your_username"
# 修改邮箱
$ git config --global user.email "your_email"
# 查看当前用户
$ git config user.name
# 查看邮箱
$ git config user.email

生成gitee和github的SSH Key

  • 打开 git Bash,运行下面的命令,过程中直接按 Enter 就行
# github SSH Key
$ ssh-keygen -t rsa -C 'github邮箱号' -f ~/.ssh/id_rsa_github
# gitee SSH Key
$ ssh-keygen -t rsa -C 'gitee邮箱号' -f ~/.ssh/id_rsa_gitee
  • 这时会在你的用户家目录(Window:C:\Users\windows账户名.ssh,Linux/Mac:~/.ssh)下生成以下文件:
    win10 SSH Key

github和gitee添加SSH KEY

(下面以gitee为例)
进入个人账户的设置目录:
gitee SSH
需要注意的是,公钥一栏复制的时上述生成文件中的.pub文件的内容,即:id_rsa_gitee.pub(这里使用记事本打开)。
另外提示一下,gitee这里粘贴公钥之后,标题自动显示,github需要手动添加标题(这里的标题内容默认为生成对称秘钥使用的邮箱)。


配置config文件

进入.ssh目录下,新建config文件,打开 git Bash,运行下面的命令

$ cd ~/.ssh
$ touch config
$ vim config

输入以下内容:

# gitee
Host gitee.com
HostName gitee.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_gitee
# github
Host github.com
HostName github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa_github

输入wq保存退出即可!


测试配置

$ ssh -T git@gitee.com
Hi [your_account_name]! You've successfully authenticated, but GITEE.COM does not provide shell access.

$ ssh -T git@github.com
Hi [your_account_name]! You've successfully authenticated, but GitHub does not provide shell access.

出现上述结果就证明配置成功!


语雀文档地址

https://www.yuque.com/docs/share/7ce33b5d-5563-400e-991b-f4b71f6ad618?#

参考地址

https://blog.csdn.net/dubulingbo/article/details/108549185

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值