20

I'm trying to clone/pull a repository in another PC using Ubuntu Quantal. I have done this on Windows before but I don't know what is the problem on ubuntu. I tried these:

git clone file:////pc-name/repo/repository.git
git clone file:////192.168.100.18/repo/repository.git
git clone file:////user:pass@pc-name/repo/repository.git
git clone smb://c-pc/repo/repository.git
git clone //192.168.100.18/repo/repository.git

Always I got:

Cloning into 'intranet'...
fatal: '//c-pc/repo/repository.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly

or

fatal: repository '//192.168.100.18/repo/repository.git' does not exist

More:

  • The other PC has username and password
  • Is not networking issue, I can access and ping it.
  • I just installed git doing apt-get install git (dependencies installed)
  • I'm running git from the terminal (I'm not using git-shell)

What is causing this and how to fix this? Any help would be great!

UPDATE

I have cloned the repo on Windows using git clone //192.168.100.18/repo/intranet.git without problems. So, the repo is accessible and exist! Maybe the problem is due user credentials?

Tomás Ramírez
  • 353
  • 1
  • 3
  • 8

3 Answers3

28

It depends on how you have your server configured to serve content.

If over ssh:

git clone user@192.168.100.18:repo/repository.git

or if a webserver is providing the content (http or https)

https://user@192.168.100.18/repo/repository.git

or if available via a file path:

git clone file://path/to/repo

or if the server is running the git daemon:

git clone git://192.168.100.18/repo
16

The manual for git-clone says:

Git natively supports ssh, git, http, https, ftp, ftps, and rsync protocols

Note that SMB is not in the list.

When running git on Windows, the //host/path syntax works because the OS supports it natively - SMB remote paths can be used anywhere a local path can be used. That is not the case in unix, where SMB is an alien thing, and // is equivalent to / in the pathname resolution algorithm.

mount the remote filesystem, then you will have the ability to refer to it with a unix-style pathname that git (and every other tool on the system) understands.

For information on mounting smbfs: https://askubuntu.com/questions/137011/how-to-mount-a-samba-shared-folder-ubuntu-x-ubuntu

3

This issue seems similar to https://stackoverflow.com/questions/5200181/how-to-git-clone-a-repo-in-windows-from-other-pc-within-the-lan. Perhaps the administrative share helps alleviate the problem (e.g. //pc-name/c$/path/to/repo)

Jeff Stice-Hall
  • 349
  • 2
  • 5