Create git repo on local PC and then clone repo across local file system in linux

StackOverflow https://stackoverflow.com/questions/19905554

  •  30-07-2022
  •  | 
  •  

Pregunta

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?

¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top