Using a shared local network folder in a Windows environment as Git repository

On my current project I try to learn new web technologies: HTML5, CSS3, JavaScript, jQuery etc. When dealing with the different versions of JavaScript-libraries I hit "git" the first time. Almost any library seems to be published using GitHub nowadays. Since we needed a VCS I had the option to take the old Subversion and deal with that system or try the new Git system. Reading about it I was getting more and more curious about it. I liked the idea about a repository on the internet like GitHub, which would give us the opportunity to work in shared teams.

So I installed git for testing and made my first tries. After several hours of trying to get connected to GitHub I had to abandon this. I was (and am still) very disappointed: Of course I'm behind a firewall, of course we use a proxy at the company I work at. I tried different hacks about telling git the proxy server etc. Which is by the way a very bad solution since this is stored in a file on your home directory called ".gitconfig". Since you have to authorizie on our proxy you have to give your current windows user name and password, and the password is stored plain text in this file - a no go! Anyway it didn't work even with these settings, and this is also just a workaround for getting "http:"-repostitories: If it comes to "git:"-repositories every proxy server and security settings will filter this away. No way to get it working and I gave up on this. The impression stays alive that Git and GitHub is some playground for Linux-freaks (which I used to be some ten years ago) and private hackers: No support on how to get this thing working in a business environment - quite frustrating!

The only work around was using a local network shared repository. Did I already mention that if you're dealing with Git you get the impression that it's Linux/Unix playground? All examples are in a shell, git itself seems to depend on a bash shell. OK I forgot the Mac Users: They have the shell now, too. So I felt a little bit lost there, anyway I was able to reactivate my old Linux know how, even made some examples in vi and relished on this nostalgy trip into the stone ages of software development. What drove me really crazy: There's a very good explanation how to set up a file sharing repository for Git. Again Linux style. Well: Unfortunately we don't have any "/share" directory easy accessible. I only have an old windows box at my work. So how could I get the examples working in a windows environment? The other hosting ideas like Apache etc. seemed a little bit overdressed for my tiny test project. It took me some hours. When you got the solution, it's quite easy. The question is as simple as this: How do you express URL's for Git in a windows envirionment so Git is able to understand that? As I said before: There is no easy-to-use "/share" directory in Windows.

The share is on a server named "xxx". The folder to use there contains whitespaces ("Apache Software Foundation"). So what? After some hours of trial and error: Here is the ultimate URL for Git in a windows environment:

  • Don't use any "\", use "/" instead.
  • Dont't try any combination with "file:", "file:\", "file://", "file://\", "file://\\", ... 
  • Don't try to use network drive letters. This won't do it, or at least not immediately. I used a network drive letter "L:" and couldn't use it with "/l". I even restarted the computer. Didn't work. The next day it worked (don't ask me why) but I wouldn't recommend this in general. Stick to the solution below:
  • For URL's with white spaces: Use ' to escape the whole URL. 
  • So this is the solution:
    • '//your-server-name/Your directory including whitespaces/...'
    • example: git remote add origin '//emm-p-ntr001/Apache Software Foundation/GitRepository'
I know this looks very trivial. Anyway I could imagine a lot of people struggling with the same sort of problems: Making git accept Windows URLs.

I almost abandoned all my tries with Git. Now it works and I can keep on learning. Still there is a stale stench for me since the impression remains that all this stuff is done by some hackers outside of any business environments. Perhaps anybody can give me a really working hint on how to connect to GitHub using a proxy server?

Thanks and regards,

Stefan

Kommentare

  1. helped me out too. Thanks~

    AntwortenLöschen
  2. Hi,
    You have posted Very good information on to all readers .surely i am very much interested in reading this type of articles .keep posting more articles.
    oracle EBS training

    AntwortenLöschen

Kommentar veröffentlichen

Beliebte Posts aus diesem Blog

Migrating an old .NET application including Crystal reports to the new world: A tale from the valley of sorrows

Using the MOQ framework to compare objects or: why equals are (not always) equal