1

Following the steps suggested in this answer, I managed to set a repository on my local machine, push it to the bare repository on the dropbox folder and clone it to another local location. That is, invoked git clone ~/Dropbox/git/project.git . in a directory ~/project-image. This means that it seem to work fine - at least for me alone.

However, I don't manage to clone it using https. From dropbox I obtained the URL of ~/Dropbox/git/project.git and then tried something like

git clone https://www.dropbox.com/sh/xxxxxxx/xxxxxxx .

in another directory ~/project/image2~. This didn't work... I got the following error:

warning: remote HEAD refers to nonexistent ref, unable to checkout.

In the answer I mentioned it seems like it is possible to share the bare repository from dropbox. How? It seems like the URL of the subdirectories changes for each subdirectory and thus git cannot clone. Is this the reason? Is there a way to overcome this? Note that I don't want to put the repository on the public part of my dropbox and I want to share a link if needed.


Edit - Verify the repository on dropbox: As per @Idx suggestion I ran, in ~/Dropbox/git the following: cat project.git/HEAD which returned ref: refs/heads/master.

Community
  • 1
  • 1
Dror
  • 12,174
  • 21
  • 90
  • 160
  • First check that your git metadata is okay. What does `cat .git/HEAD` say? It should reference a head, e.g. `.git/refs/heads/master`. – ldx Mar 05 '13 at 14:52
  • @Idx: see my edit. I get something which is similar to what you wrote, but not exactly. – Dror Mar 05 '13 at 14:59
  • Ah I see you're trying to use http - no go. It needs a server-side backend for git to work. – ldx Mar 05 '13 at 15:13
  • @Idx: can you please elaborate on this? In particular with respect to the answer I linked to, where he suggests that it is possible(?) – Dror Mar 05 '13 at 15:17
  • There he writes `$ git remote add origin ~/Dropbox/git/project.git`, so it's using plain filesystem access, not HTTP. For Git via HTTP, you need server side support, see https://www.kernel.org/pub/software/scm/git/docs/git-http-backend.html – ldx Mar 05 '13 at 15:22
  • @Idx: So what exactly does it mean to share over your local filesystem? Share with you and yourself? – Dror Mar 05 '13 at 15:24
  • Why don't you just use github.com? – carlspring Mar 05 '13 at 15:36
  • @Dror it means that it's available via regular, plain old local filesystem access, no HTTP. – ldx Mar 05 '13 at 16:03

1 Answers1

1

For git to be able to clone or fetch from an http server that doesn't have support for git's smart http protocol (which would be the case for Dropbox), you need to run git update-server-info any time that you update a ref (branch or tag) in the repository being served in that way.

Depending upon how you are intending to do updates to that repository, you may be able to setup one or more hooks to do this for you automatically.

qqx
  • 18,947
  • 4
  • 64
  • 68
  • Doesn't this require server-side WebDAV support? – ldx Mar 05 '13 at 16:34
  • @ldx No, just plain HTTP. Actually, it's even more generic than that; a repository where that command has been run would also be accessible using FTP or rsync. – qqx Mar 05 '13 at 17:32