Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git on UNC path

Tags:

git

cmd

I have computer with Windows XP and no Internet connection, only access to network drive. I'd like to set up a git repository on the network drive and then push to it from my local repository, so I can at the end of the day go to a computer with Internet connection and push from network drive to github.

My problem is I cannot access network drive from git. I put PortableGit on the network drive, but git-bash.bat and git-cmd.bat die with "CMD does not support UNC paths as current directories.". I tried replacing "cd" with "pushd" in git-cmd.bat, but it doesn't work.

BTW, I use PortableGit since I don't have admin permissions on my machine.

Any ideas?

like image 358
dijxtra Avatar asked Feb 14 '11 23:02

dijxtra


3 Answers

This worked for me:

git.exe clone "d:/dev/SDK" "//comp1/Proj/git/SDK/"
like image 64
Konstantin Tenzin Avatar answered Oct 16 '22 19:10

Konstantin Tenzin


Just use the UNC path - git doesn't care what cmd can and cannot do.


Old answer: Bind the UNC path to a drive letter (or use a directory symlink).

like image 11
Tobias Kienzler Avatar answered Oct 16 '22 18:10

Tobias Kienzler


First open a windows console, Run->cmd

pushd \\172.158.1.254\network_usb

now you should be able to 'cd' through all the directories on the drive. Optionally you can type a git init --bare nameOfnewRepo.git somewhere.

popd

Now open git bash and cd to the location where you want to clone the repo on the network drive

git clone //172.158.1.254/network_usb/pathto/nameOfnewRepo.git

Note that in git bash the slashes are forward and in the windows console backward.

like image 6
MathKid Avatar answered Oct 16 '22 17:10

MathKid