0

I would like to create a git repo on my linux PC for testing so that I can then clone the repo elsewhere on my PC and do some git testing (push, pull etc...), but I don't want to use a network server - I want my local PC to also be the "repote" repo.

Part of my issue is desrcibed here for a windows box, but does not appear to work for me on my linux box: GIT clone repo across local file system

What I have got so far:

Make repo in /usr/local/git_root:

cd /usr/local/git_root
sudo mkdir testGit.git
cd testGit.git
sudo git --bare init

Then in my user area clone the project:

cd ~/sandbox
git clone file:////usr/local/git_root/gitTest.git

I get the error:

fatal: '//usr/local/git_root/getTest.git' does not appear to be a git repo fatal: The remote end hung up unexpectedly

What am I doing wrong here?

Community
  • 1
  • 1
code_fodder
  • 15,263
  • 17
  • 90
  • 167
  • 2
    You're creating your repository as root. Does your user have appropriate permissions to access it? –  Nov 11 '13 at 11:53
  • err...no :o And then I put my repo in ~/git_root and did not use "sudo" to do anything and it all started working. Thanks! – code_fodder Nov 11 '13 at 12:35

1 Answers1

2

I think you have a typo, too many forward slashes:

git clone file:////usr/local/git_root/gitTest.git

should be

git clone file:///usr/local/git_root/gitTest.git

Alternatively,

git clone /usr/local/git_root/gitTest.git

Edit:

For posterity, the comment above alludes to the fact that the cloning user needs to have root access to the folder.

T. Furfaro
  • 2,127
  • 1
  • 12
  • 8
  • I tried both of these (infact I have tried all the combos in the link) and nothing is yet working :( – code_fodder Nov 11 '13 at 12:09
  • The "file:///usr..." version doesn't work for me, but "/usr/local..." does. You've tried that one? – T. Furfaro Nov 11 '13 at 12:17
  • 1
    I did... but then I saw the comment from hvd regarding permissions and with a combo of your answer and his comment its all working now! (both, "file:///..." and just "/...") thanks :) – code_fodder Nov 11 '13 at 12:36