git 设置有问题

Trouble setting with git

我在尝试设置 git 初始化时遇到此错误:

$git 初始化 错误:无法锁定配置文件 C:/Users/khaled/Desktop/firstTemplete/.git/config: 没有那个文件或目录 致命:无法将 'core.repositoryformatversion' 设置为“0”

有人知道吗?

调用 git init 时,.git 目录由 GIT 创建,并创建与 repo 相关的元信息,包括提交历史记录。 这是一个问题,因为当前用户的写入权限不合适。

  • 使用sudo git init
  • 或者使基本目录对默认用户可写
  • 您可能没有足够的文件夹写入权限。尝试使用具有管理员权限的 git init。

    1. 使用管理员权限打开终端。
    2. 转到文件夹的位置。 cd C:/Users/khaled/Desktop/firstTemplete/
    3. 尝试 git 初始化。

    在 Windows 中,可能是由于病毒和威胁防护软件阻止了未经授权的文件夹更改。

    1. 打开您的 Windows Defender 安全中心
    2. 回到首页
    3. 单击并打开 "Virus and Threat protection"
    4. 单击并打开 "Virus and threat Protection Setting"
    5. 在"Controlled folder access"选项
    6. 中单击并打开"Manage Controlled folder access"
    7. 关闭 "Controlled Folder access"

    运行 "Git init" 来自 cmd。 完成!