Add file:// as a suitable protocol (#1)#1184
Add file:// as a suitable protocol (#1)#1184pydanny merged 2 commits intocookiecutter:masterfrom ivanovmg:master
Conversation
* Add file:// as a suitable protocol This is required if the repo is stored in Windows server, or other shared folder.
docs/usage.rst
Outdated
| $ cookiecutter https://github.com/audreyr/cookiecutter-pypackage.git | ||
| $ cookiecutter git+ssh://git@github.com/audreyr/cookiecutter-pypackage.git | ||
| $ cookiecutter hg+ssh://hg@bitbucket.org/audreyr/cookiecutter-pypackage | ||
| $ cookiecutter file://path/to/server/repo.git |
There was a problem hiding this comment.
The file:// protocol requires 3 slashes as it works only with full paths (mostly due to security).
I think that the examples should include correct file examples.
There was a problem hiding this comment.
Thank you for the feedback!
The problem is that when I try to clone repo using the command with 3 slashes, it leads to an error.
$ git clone file://server/folder/project.git
Cloning into 'project'...
fatal: 'C:/Program Files/Git/server/folder/project.git' does not appear to be a git repository
fatal: Could not read from remote repository.
For some reason it would search under the folder with git executable, rather than in the absolute path. When I use 2 slashes, like in my example, it works.
OS Windows 10, GitBash or cmd.
Technically, I just need to clone from this kind of path //server/folder/project.git. I figured out, that using the current code and simply allowing file:// (with 2 slashes) to be treated as an url, makes it all work.
Maybe, you can suggest how we can tell cookiecutter to treat //server/folder/project.git as a remote location to make it clone from it?
Thank you in advance!
There was a problem hiding this comment.
Please check https://tools.ietf.org/html/rfc8089 and its original rfc. I am unable to see any valid use of file:// because the first part after it would be a server, not a PATH. Pointing something to local machine woudl require 3 slashes.
There was a problem hiding this comment.
I should have mentioned that more clearly in the docs example. My intention was to use file://server/folder/project.git as I mentioned in my previous message. And it stays in accordance with what you have just mentioned.
Should I just update the example to file://server/folder/project.git ?
There was a problem hiding this comment.
Yeah, I think that using server is a good compromise. I just wanted to avoid confusing people into using incorrect file URIs, ones that are not portable.
|
I'm trying to run cookiecutter against a local, version controlled, repository and the I am also uncertain of where the |
|
After a quick skim through *aside: * I'll fire up a development environment for this when I have time again but for today I'm out of moonlight. |
Add file:// as a suitable protocol
Required if the repo is stored in Windows server, or other shared folder.
Enables the following:
$ cookiecutter "file://path/to/server/repo.git"