gabrielcsapo / node-git-server

🎡 A configurable git server written in Node.js
https://gabrielcsapo.github.io/node-git-server
MIT License
253 stars 73 forks source link

Unable to clone when there are spaces in repository name #67

Closed AdityaNambiar closed 4 years ago

AdityaNambiar commented 4 years ago

Hello, I am trying to clone a repository which is on my local system. It works if I try to use relative path to the '.git' directory:

playground@adityanambiar-HP:~$ git clone isomorph_git-test/nodeserv/projects/bare/new\ app.git/ 
Cloning into 'new app'...
done.
playground@adityanambiar-HP:~$ cd new\ app/
playground@adityanambiar-HP:~/new app (master)$ git log --oneline -1
0cff839 (HEAD -> master, origin/master, origin/HEAD) 1st

But when I use it with the HTTP protocol (like so with the localhost:port), it gives a

playground@adityanambiar-HP:~$ git clone "http://localhost:7005/projects/bare/new app.git" 
Cloning into 'new app'...
fatal: unable to access 'http://localhost:7005/projects/bare/new app.git/': The requested URL returned error: 400

This is not the same if the repository does not have spaces, which means that it works for repositories that do not have spaces on their name:

playground@adityanambiar-HP:~$ git clone "http://localhost:7005/projects/bare/sgit.git/"
Cloning into 'sgit'...
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), 187 bytes | 187.00 KiB/s, done.

Unfortunately, git only throws the error and does not elaborate what went wrong. I am looking for a solution to perform 'git clone' on such user repositories via node-git-server.

onelikeandidie commented 4 years ago

Don't you have to use %20 instead of spaces in URLs? Maybe try that.

AdityaNambiar commented 4 years ago

That did not work, unfortunately. I also tried '+' but it just takes the literal string.

playground@adityanambiar-HP:~$ git clone 'http://localhost:7005/projects/bare/proj%2001.git'
Cloning into 'proj%2001'...
warning: You appear to have cloned an empty repository.
onelikeandidie commented 4 years ago

Maybe it's because you're using quotes around the URL. Instead of: $ git clone 'http://localhost:7005/projects/bare/proj%2001.git' Try like: $ git clone http://localhost:7005/projects/bare/proj%2001.git That way git will take the URL instead of a literal string?

AdityaNambiar commented 4 years ago
playground@adityanambiar-HP:~$ git clone http://localhost:7005/projects/bare/proj%2001.git 
Cloning into 'proj%2001'...
warning: You appear to have cloned an empty repository.

It still takes it as literal string. Just to be sure that it can access it at the same place (there is no authentication, neither on node-git-server nor on the repo), I tried git clone from the filesystem:

playground@adityanambiar-HP:~$ git clone Downloads/MajorProject/MajorProject-master/IpfsServer/projects/bare/proj\ 01.git/ ./'proj 01'
Cloning into './proj 01'...
done.

Anyway, I don't require to find a solution for this now because we decided to substitute spaces in repository names with hyphens just like how GitHub does.

However if you wish to try it yourself and post it here, you may do so otherwise I'll close this issue tomorrow.