git 权限配置

账号密码管理仓库

win 凭据

  1. 打开控制面板

  2. 右上角搜索凭据

  3. 点击管理 Windows 凭据

  4. 找到你的gitee凭据操作

    mac 钥匙串

  5. 启动台

  6. 其他

  7. 钥匙串访问

ssh 配置

生成 ssh

ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

  • 复制指令
    • win—>clip < ~/.ssh/id_rsa.pub
    • mac—>pbcopy < ~/.ssh/id_rsa.pub

ssh文件示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Host 39.100.*.*
HostName 39.100.*.*
User root
ForwardAgent yes

Host github.com
HostName github.com
User baran
PreferredAuthentications publickey
IdentityFile E:\git\baran-demo

Host github.com
HostName github.com
User cxvh
PreferredAuthentications publickey
IdentityFile C:\Users\你的用户名\.ssh\id_rsa

Host code.aliyun.com
HostName code.aliyun.com
User cxvh
PreferredAuthentications publickey
IdentityFile C:\Users\你的用户名\.ssh\alicode\id_rsa

Host gitlab.com
HostName gitlab.com
User cxvh
PreferredAuthentications publickey
IdentityFile C:\Users\你的用户名\.ssh\gitlab\id_rsa

查看配置文件

1
2
3
4
# 常用指令
less ~/.gitconfig # 查看账号配置
vi .git/config # (工程当前路径的Git配置文件)
vi ~/.gitconfig # (全局的Git配置文件)