git 报错集合

发布时间 2023-04-04 11:39:17作者: 皮皮买
  1. key does not contain a section: global
    设置邮箱时,git config -- global user.email "caohan@agree.com.cn",命令--和global之间不能有空格。

2.detected dubious ownership in repository at '/Users/caohan/workSpace/webide/webide'
To add an exception for this directory, call:
跑下面命令即可:git config --global --add safe.directory "*";

3.cannot open '.git/FETCH_HEAD': Permission denied
原因在于mac .git文件夹下的FETCH_HEAD文件权限不足。

sudo chown -R caohan:staff .git
//caohan 是当前用户
//staff 是用户所属组

不知道当前用户组输入查询

groups // 查看当前用户所属组
groups user_name // 查看指定用户所属组
 
Note:用户所属组可能有多个
 
id -a user_name // 可以查到指定用户所属组更详细的信息
 
查看当前用户的用户名:whoami