1

basically this is my problem: I have access from my PC to a repo requiring authentication. There's a second PC on which I have to work and I would like to have all my repo files updated on it accordingly. However, I cannot ask for access also from this second PC (there's 1:1 policy between ssh-keys and users, or something like that).

So, is it possible to sync files from my 1st PC to the second by simply typing "git pull" on the second, so that the 1st pc acts like the origin?

I understand that this could not work both ways (e.g. "git push" from the 2nd to the 1st), but 99% of the times I just need to have the repo as readonly -- I code on the 1st PC, I use the 2nd for running the code.

origin <------ push/pull ----> 1st PC ---- only pull ---> 2nd PC

Thanks a lot for the help, and apologies if the question sounds silly :)

CaptainPhlegm
  • 121
  • 1
  • 11

1 Answers1

1

If you have a file access to PC1 from PC2, you can clone local repository by typing the following command:

git clone file:////host/share/path

See GIT clone repo across local file system in windows for more details.

Community
  • 1
  • 1
Fabien Fleureau
  • 693
  • 5
  • 14
  • works perfectly for my needs. I couldn't believe a git clone was all I needed. :) thanks – CaptainPhlegm Jul 21 '14 at 14:02
  • 1
    detailing the steps that I needed to do (both computers are Windows-based, and are on the same subnet, eg. 192.168.1.0/24): 1) configure Windows Firewall on PC1 so not to block local network activity; 2) configure network sharing of the root folder (e.g. C:\repo) of the git dir you want to clone (e.g. C:\repo\project1); 3) git bash on PC2, create a parallel C:\repo dir, 'cd' into it, and execute "git clone ///project1" (notice the use of "/"). If this works, later updates are done by goin in C:\repo\project1 dir on PC2 and execute "git pull --rebase". – CaptainPhlegm Sep 10 '14 at 14:52