Skip to main content

Deals You Can't Miss

1 Year Subscription

Unable to checkout Git repo on Windows?

This post is about looking into the order in which you debug the reason for your inability to checkout Git repo on Windows operating system. It could be because of the following reasons and you should debug in that order:
  1. Existence and validity of your SSH Keys
  2. Presence of files in your git repository whose names are reserved words in Windows OS
The next section of the post delves into these two pointers in detail.

Existence and validity of your SSH Keys


  • You should have SSH keys (typically id_rsa and id_rsa.pub) in your operating system path $HOME/.ssh/. If not generate it with ssh-keygen.
  • You should have the contents of the public key (id_rsa.pub) added to your list of SSH Keys in your Git remote repository. In the case of Github, it will be in your personal settings page

Windows OS incompatible file names in your git repository


This is a little crazy Windows OS weirdo. After making sure that I indeed have the SSH Keys setup right both in my local windows-os and in the remote Git repository (Github in my case). But how do you do that? 

After hours of hair-splitting to think that SSH keys isn't setup right and I was only left frustrated and hopeless. A little insight into why I was misled to thinking so and you too could be trapped by this very step. I tried what others prescribed to validate this, which is to run the below commands:
ssh -T git@github.com
ssh -T your-github-id@github.com
While the first command turned out successful, the second one failed with an exception stating, "... Permission denied (publickey)" leading me into the rabbit hole to be lost in darkness.

The best thing to do when your lost is to take a break from the problem. You would still be thinking about it at the back of your mind, which is a good sign ;)

So after my break and back at my desk, the next thing that I tried was do exploratory testing to validate my assumption. And so I tried to checkout a couple of other repositories to see if that works. And it did. Damn, my SSH Keys setup was indeed right and that I was wrong to assume that I missed something right there. 

Side-note: Best test case for this kind of use-case is to create a simple repository with only a Readme.md file in it and see if you can checkout that repository. If that works good, the problem is likely with your operating system and the repository contents. In my case the remote repository had a file named aux.js
 
So now the problem is with my current repository which worked in my other laptop having Ubuntu OS? That leads me to wondering if there is something in my repository that my Windows OS isn't liking? I slap myself and get back to basics of reading that error I get when I checkout this troubling git repository. The error message that I got mid-way through checking out read something like below:
error: invalid path 'src/hoc/aux.js'.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry with 'git restore --source=HEAD :/'
I now have zoomed in into the file aux.js as the possible cause, because windows is unable to create that file. When I tried to manually create a file by that name, I was shocked to learn that windows doesn't allow me to create one by that name, because aux is a reserved name in windows that refers to some device. And boy Windows has quite a few such reserved names and if you got files created by those names in your non-windows operating systems that make it to remote Git repository, your other developers using windows operating systems will be at a loss. 

There are other such reserved names in windows os. Do not use the following reserved names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3,..., LPT1, LPT2, LPT3, ... Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended.

Below are two possible ways to solve this problem: 
  • The quick and easy route is to change your git config by running: git config core.protectNTFS false
  • The other is the hard route that I recommend for portability reasons, if it is doable in your project. And that is to rename the file to something that windows developers can consume without any issue.
It is important to know the other windows operating limitations as well for project portability on windows platforms:
  • In Windows, filenames are case-insensitive.
  • In Windows, certain characters are not permitted as part of file names.
For this reason, it is important to consider the following links to see if you have broken any of windows conventions in your file naming:

My Popular Posts

Ten Commandments of Egoless Programming

We are nothing but the values we carry. All through my life thus far, I tried to influence people around me with the virtues I value. Thanks to some good reading habits I had inculcated, and the fortune of being in good community of peers and mentors alike, I managed to have read some real good books. This post is about the 10 commands of egoless programming in Weinberg's book. I shall explain the commandments based on my experience here. So very many decades ago, Gerald M. Weinberg authored  The Psychology of Computer Programming . In it, he listed The Ten Commandments of  Egoless Programming , which remains relevant even today for us as not just programmers but as team-members. Weinberg is regarded as a pioneer in taking a people-centric approach to computing, and his work endures as a good guide to intelligence, skill, teamwork, and problem-solving power of a developer. When they appear to inspire and instruct, we find that they can apply to just about every business area, and e

Should I buy refurbished laptop from Amazon?

This post is based on my experience with amazon.in and guess it to be true on all other platforms as well. At least you can check out and verify for these pointers before you make that decision to buy renewed/refurbished laptop on Amazon with your hard earned money. I see this question propping up in several forums and on many different occasions. In the recent past, I had my 5 year old dell laptop that gave up because its motherboard failed. One of the options that I had in my mind was to re-use the HDD and the 16GB DDR4 RAM of that old laptop in the one that I purchase next as secondary.  I had come to a conclusion that it is not worth buying a refurbished/renewed laptop at all. Why? For the following reasons, most of which I see as BIG #RedFlags: You got to remember that Amazon provides a platform for 3rd party sellers to sell their products as well. So in your search for refurbished laptops you wouldn’t want to choose some random 3rd party seller who Amazon doesn’t endorse. You cou

Multi-tenant Architectures

  Multi-tenancy Application Deployment Architecture could be modeled in 4 broad ways: Separate Apps & Separate Databases Shared Apps & Shared Databases Separate Apps & Shared Databases Shared Apps & Separate Databases There is no right or wrong here. It's about choice and consequence that you should consider taking into your business context and constraints. In this post I intend to jot down a some key points to keep in mind for each of these multi-tenant architecture. These are more of quick notes for my quick reference, a cheat-sheet of sorts when I have to make choices. And I guess this can come handy to you too in your wise decision making. Separate Apps & Separate Databases Easiest to implement from development and deployment stand-point. Just automate the deployment infrastructure for every tenant for quick set-up. Most expensive of all the models from infrastructure cost stand-point. Relatively longer deployment t