4

I have windows 7 installed.
C:\ is a local drive. H:\ is a work network drive that continually re-installs every time I boot. I have learned to just disconnect it whenever I am doing any coding from home or installing coding related apps, as I tend to have issues.

I installed Git and tried to create a repository for the first time.
It gives me the following error:

error: could not lock config file H:\/.gitconfig: No such file or
directory error: could not lock config file H:\/.gitconfig: No such
file or directory
     while executing "exec {C:/Program Files/Git/libexec/git-core/git-config.exe} --global --add
 gui.recentrepo C:/Users/bmyhre/Desktop/Testing/projects/skeleton"
     ("eval" body line 1)
     invoked from within "eval exec $opt $cmdp $args"
     (procedure "git" line 23)
     invoked from within "git config --global --add gui.recentrepo $path"
     (procedure "_append_recentrepos" line 16)
     invoked from within "_append_recentrepos [pwd]"
     (procedure "_git_init" line 17)
     invoked from within "_git_init $this"
     (procedure "choose_repository::_do_new2" line 5)
     invoked from within "choose_repository::_do_new2 ::choose_repository::__o1::__d"
     invoked from within ".buttons.next invoke "
     invoked from within ".buttons.next instate !disabled { .buttons.next invoke } "
     invoked from within ".buttons.next instate pressed { .buttons.next state !pressed; .buttons.next instate !disabled { .buttons.next invoke
 } } "
     (command bound to event)

My guess is that it is trying to reach the H: drive somewhere (I installed it with H: disconnected), but I don't know where/how to change this so it actually looks where the real .gitconfig on the C: drive is.
How to avoid this error message?

3
  • Do you have a file like C:\Users\{username}\.gitconfig that might be of any interest?
    – random
    Commented Dec 15, 2013 at 2:00
  • There is a .gitconfig file at C:\Program Files\Git\etc
    – notthehoff
    Commented Dec 18, 2013 at 1:55
  • 1
    My end solution was to get a Mac. :)
    – notthehoff
    Commented Nov 20, 2014 at 14:13

1 Answer 1

7

Check if you have an %HOME% environment variable defined.

If that variable exists and refers to H:\ (instead of %USERPROFILE%), then it will look for the global git config file in H:\.gitconfig (meaning %HOME%\.gitconfig).

Changing that %HOME% variable to a local path like %USERPROFILE% would solve that issue.

11
  • Where would I see that? Here are the contents of my .gitconfig file that exists at C:\Program Files\Git\etc [core] symlinks = false autocrlf = true [color] diff = auto status = auto branch = auto interactive = true [pack] packSizeLimit = 2g help center format = html [http] sslCAinfo = /bin/curl-ca-bundle.crt [sendemail] smtpserver = /bin/msmtp.exe [diff "astextplain"] textconv = astextplain [rebase] autosquash = true
    – notthehoff
    Commented Dec 18, 2013 at 1:57
  • @user1525974 Check first your environment variables (with set, or echo %HOME% )
    – VonC
    Commented Dec 18, 2013 at 6:55
  • 1
    This worked. I just created a new environment variable named HOME and set the value to %USERPROFILE%, worked great. Commented Jun 8, 2015 at 22:32
  • @BrainSlugs83 Note that with the latest Git for Windows (2.4.x: github.com/git-for-windows/git/releases), this is done for you when running git-cmd.exe.
    – VonC
    Commented Jun 8, 2015 at 22:34
  • I did that, and also I have a .gitignore file in %USERPROFILE%\.gitconfig but am still getting this error error: could not lock config file .git/config: No such file or directory
    – Lrrr
    Commented Jun 23, 2015 at 10:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .