vscode插件-GitLens使用时,不显示行末的提交信息(user、branch、commit信息、time等信息)提示
出现问题时的自查:
vscode的系统设置与gitlens插件设置,均已设置显示。
gitlens.toggleLineBlame = true
gitlens插件设置 - Current Line Blame,已勾选。
运行git指令时会报错:【重要】
> git remote
fatal: detected dubious ownership in repository at 'C:/Users/xxx/Desktop/Projects/xxx/xx-xx'
'C:/Users/xx/Desktop/Projects/xx/xx-xx' is owned by:
'某个代表身份的字符串'
but the current user is:
'另一个代表身份的字符串'
To add an exception for this directory, call:
git config --global --add safe.directory C:/Users/xx/Desktop/Projects/xx/xx-xx
出现问题的原因:
本地仓库的所有者与当前的用户信息不一致。【与上述代码块中的错误提示一致】
解决办法:
【与上述代码块中的错误提示一致,按照提示运行指令即可】
运行 git config --global --add safe.directory C:/Users/xx/Desktop/Projects/xx/xx-xx
ps: 其实在每次打开vscode时,在右下角都会有git的错误提示弹框,但我自己平时没有注意过,不知道错误来源于此。其实主要是代码仓库在不同设备之间转移时(git push/pull/clone),用户身份的判断出现了问题。
在使用vscode的GitLens插件时遇到行末不显示用户、分支、commit和时间信息的问题,原因是本地仓库所有者与当前用户信息不一致。通过运行`gitconfig--global--addsafe.directoryC:/Users/xx/Desktop/Projects/xx/xx-xx`来解决权限错误,添加安全目录设置。



558

被折叠的 条评论
为什么被折叠?



