Trouble setting with git

3.5k views Asked by At

I'm getting this error when trying to set the git init:

$ git init error: could not lock config file C:/Users/khaled/Desktop/firstTemplete/.git/config: No such file or directory fatal: could not set 'core.repositoryformatversion' to '0'

anyone have any idea ?

3

There are 3 answers

0
Muhammad Etisam Zafar On BEST ANSWER

In Windows, the problem could occur due to the unauthorized changes for a folder are blocked by the virus and threat protection software.

  1. Open your Windows Defender Security Center
  2. Go to Home
  3. Click and open "Virus and Threat protection"
  4. Click and open "Virus and threat Protection Setting"
  5. Click and open "Manage Controlled folder access" in "Controlled folder access"option
  6. Turn the "Controlled Folder access" OFF

Run "Git init" from cmd. DONE!

0
Rishabh Agarwal On

You might not be having sufficient write privileges in the folder. Try using git init with admin access.

  1. Open terminal with Admin access.
  2. Go th location of folder. cd C:/Users/khaled/Desktop/firstTemplete/
  3. Try git init.
1
gurpreet singh chahal On

When git init is invoked, .git directory is created by GIT and meta information related to the repo including the commits history is created. This is an issue due to inappropriate write privileges for the current user.

  • Use sudo git init
  • Or make the base directory writable for the default user