无法从终端访问 git

unable to access git from terminal

git config --global user.name "chirrumishra"                                                       ✔ 
error: could not lock config file /Users/chiranjeevmishra/.gitconfig: No such file or directory

唯一可用的数据 git config --list credential.helper

尝试使用 brew 重新安装 git 但由于某些未知原因它也不起作用

 ~  brew reinstall git                                                                        INT х │ 7s 
==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.33.0
Already downloaded: /Users/chiranjeevmishra/Library/Caches/Homebrew/downloads/b24ae98d6ab2b75abc62451721dc6191764b44543e218d5f937f6e85d4b11b17--git-2.33.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:1b89ec39f7a4b865b3c671f9b2495ec859925951
Already downloaded: /Users/chiranjeevmishra/Library/Caches/Homebrew/downloads/6a93895ce790e15c09265ac022b1830dc40f083404f5059ce8c0c99814c8074e--git--2.33.0.big_sur.bottle.tar.gz
==> Reinstalling git 
==> Pouring git--2.33.0.big_sur.bottle.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
  /usr/local/Cellar/git/2.33.0: 1,508 files, 42MB
==> `brew cleanup` has not been run in 30 days, running now...
Error: Permission denied @ apply2files - /usr/local/lib/docker/cli-plugins


 ~  git config --global credential.helper store                                                1 х │ 38s 
error: could not lock config file /Users/chiranjeevmishra/.gitconfig: No such file or directory

正在使用的操作系统:Mac OS Big Sur 11.4 酿造版本:自制软件 3.2.9 git 版本:git 版本 2.33.0

提前致谢

要修复 Permission denied,您可以 运行 :

sudo chown -R ${LOGNAME}:staff /usr/local/*

希望 .gitconfig 问题也能得到解决。