6

My question is NOT this question.
On performing a git clone I am getting this error. Command than I am using is:

$ git clone "https://gdt.test.com/gitblit/log/?r=mytest.git&h=refs/heads/branch_development"

On simply running:

$ git clone "https://gdt.test.com/gitblit/log/?r=mytest.git"

I get the error:

fatal: could not create work tree dir '?r=mytest'.: Invalid argument

I think I need to put the full URL along with r and h parameters. Because these parameters specify the name of my repository.

I was doing a mistake (copying and pasting the URL). However, even on using the URL:

gdt.test.com/gitblit/r/mytest.git/

I am getting error:

'fatal: repository 'gdt.test.com/gitblit/r/mytest.git/'; not found. 

How to copy correct URL from gitblit summary page?

Community
  • 1
  • 1
Farrukh Chishti
  • 7,652
  • 10
  • 36
  • 60
  • 1
    I can clone it just fine. Btw how is this related to gerrit? – Tim Apr 28 '15 at 06:54
  • But does your local directory have a git folder? – Vaulstein Apr 28 '15 at 06:55
  • @Vaulstein: Yes my local directory has a .git folder. First I performed 'git init'. – Farrukh Chishti Apr 28 '15 at 06:56
  • @TimCastelijns: But how can you clone a git URL that does not terminate with .git? – Farrukh Chishti Apr 28 '15 at 06:57
  • 1
    @QualtarDemix Are you sure you want to `init` and then `clone`? The usual way is *either* `init` then `remote add` *or just* `clone`. – Biffen Apr 28 '15 at 06:59
  • @Biffen: I performed git init to simply create a .git folder. But in future i'll take care. – Farrukh Chishti Apr 28 '15 at 07:00
  • 3
    @QualtarDemix `clone` will do that for you. Also, `init` will create a `.git` directory *in the current directory*, whereas `clone` will clone into a subdirectory in which the `.git` directory will be created (unless otherwise specified). – Biffen Apr 28 '15 at 07:01
  • 1
    @QualtarDemix Looks like it's having trouble creating a directory based on the last part of the URL. Have you tried specifying one, e.g. `git clone "https://gdt.test.com/gitblit/log/?r=mytest.git" mytest`? – Biffen Apr 28 '15 at 07:07
  • @Biffen: On running "https://gdt.test.com/gitblit/log/?r=mytest.git" I am getting a new error: fatal: could not create work tree dir '?r=mytest'.: Invalid argument – Farrukh Chishti Apr 28 '15 at 07:15

3 Answers3

7

Problem: you are copying & pasting the log webpage URL and expecting to be able to clone a repository from the generated html.

The proposed successful answer has sufficiently scrubbed the URL which hides the solution from you: you are missing the repository serving path in the URL, /r/ or /git/.

Using your URL example, the correct syntax should be:

git clone https://gdt.test.com/gitblit/r/mytest.git

The Summary page provides generated URLs with copy & paste functions to avoid these type of errors.

enter image description here

James Moger
  • 1,721
  • 12
  • 12
  • Thanks for such a detailed reply. And yes I was doing the exact same mistake (copying and pasting the URL). However, even on using the URL that you suggested I am getting error: 'fatal: repository 'https://gdt.test.com/gitblit/r/mytest.git/' not found. Also, can you please put a larger screenshot to explain how to copy URL from gitblit summary page. – Farrukh Chishti Apr 29 '15 at 10:36
  • 1
    The attached screenshot is enough. Do you see the little clipboard buttons? They are flash. They will copy the url to your clipboard for pasting. – James Moger Apr 29 '15 at 14:39
0

The url is not the path to a git repository BUT yes mytest.git is a bare repository

Edit: Try this and it works at my end

git clone https://gdt.test.com/gitblit/log/mytest.git

git clone "https://gdt.test.com/gitblit/log/mytest.git"
Cloning into 'mytest'...
warning: You appear to have cloned an empty repository.
Checking connectivity... done.
Mayur Nagekar
  • 813
  • 5
  • 13
0

Got the problem. I was using the wrong git repository altogether. Correct URL must be:

git clone https://qualtar.demix@gdt.test.com/gerrit/mytest
Farrukh Chishti
  • 7,652
  • 10
  • 36
  • 60