Cygwin - Repo with Separate Git/Working Dir Doesn't Work

Posted by Kyle Lacy on Super User See other posts from Super User or by Kyle Lacy
Published on 2012-08-29T21:52:24Z Indexed on 2012/08/30 3:40 UTC
Read the original article Hit count: 604

Filed under:
|
|
|
|

Since I've switched to OS X and Vim, I've found it easiest to manage all of my 'dotfiles' (all of my configuration files and miscellaneous scripts) with Git. Having already set up my dotfiles in a repo following this tutorial, I figured it would also be easy enough to migrate all of my settings into my Cygwin setup on my Windows partition.

Already having the repo setup on Github, I simply clone'd the repo, and moved all of the files over to my home directory, making it a mirror of my OS X home directory. Unfortunately, I cannot seem to use the actual repo any further within Cygwin.

The problem is that I cannot use my dotfiles repo with git within Cygwin. The setup is unique from most normal git repos, in that the working directory and the git directory are in different locations. Specifically, the working directory is $HOME (/Users/kyle on OS X, /home/kyle in Cygwin), and the git repo is $HOME/.dotfiles.git. So, if I wanted to get the status of the repo, for example, I would type the following command (which I alias to reduce typing, of course):

git --work-tree=$HOME --git-dir=$HOME/.dotfiles.git status -uno

While this works fine on OS X, this refuses to work within Cygwin. Regardless of whether or not I use my alias, or whether or not I substitute $HOME by hand, I get the following git error:

fatal: Not a git repository: /home/Kyle/dotfiles/.git/modules/.build/git

I don't understand where this error comes from, but the path /home/Kyle/dotfiles was the original location of the git repo when I initially cloned it. Additionally, it's important to note that the repo relies heavily on submodules. If specifics are necessary, the repo in question can be found on GitHub. The commands I ran to setup the repo in Cygwin can also be found within the Readme file.

© Super User or respective owner

Related posts about git

Related posts about cygwin