0

I need to have a portable git setup in order to access a git repository in my LAN from a portable HDD, including the computer where the HDD is connected, under Windows. The HDD might be moved from time to time between the computers in my network. I wish to avoid SSH for the moment.

I have installed the portable version of the git, I have made a batch to set the PATH to the requested directories specified in the documentation before running git-bash or git-cmd.

I see it runs, I have made a bare repository, let's say in a path like m:/repo.git. Then, I got stuck as I don't know how to configure the remote in order to do the first push as `git push repo master' from my project path.

I think I should do a 'git remote add repo ' but I fail to set the correct URL or something. I am aware I should change the URL each time the HDD is moved or change the remote.

What are the correct setup steps?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
mike
  • 408
  • 5
  • 18

1 Answers1

0

Then, I got stuck as I don't know how to configure the remote in order to do the first push as `git push repo master' from my project path

Let git create that setting for you:

git clone m:/repo.git
cd repo
git --work-tree=..\myproject add .
git commit -m "first commit"
git push

That will import the files of your project in a local repo, which will be able to push back to your bare repo on M:\.

UNC paths are supported too

git.exe clone "d:/dev/SDK" "//comp1/Proj/git/SDK/"
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Interesting, except it work with `/` only, like `m:\repo.git`. It creates `origin m:/repo.git (fetch/push)` remotes. I've tried to share in my network, to access it from another computer too. Is that possible? – mike Nov 30 '16 at 17:58
  • @mike I don't think UNC path (https://en.wikipedia.org/wiki/Path_(computing)#Uniform_Naming_Convention) are supported though. – VonC Nov 30 '16 at 17:59
  • @mike actually they are! I have edited my answer to add an example. – VonC Nov 30 '16 at 18:01
  • Well, I don't think is possible to access it through UNC over network without SSH. It keeps asking for access rights. – mike Nov 30 '16 at 18:45
  • @mike sure, it can depends on your access right. I just wanted to point out that the file protocol supports UNC path. After that you have other protocols, including SSH. https://git-scm.com/book/tr/v2/Git-on-the-Server-The-Protocols – VonC Nov 30 '16 at 18:47
  • I am admin on all the PCs of my little network. I did not create the right users on git, probably. – mike Nov 30 '16 at 19:01
  • @mike You don't create user on Git. Git ignores completely the host security, it only managed a git repo. This (access to a folder) is entirely managed at the host level, not with Git. – VonC Nov 30 '16 at 19:02