Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git not found on windows even though its there #761

Closed
Datseris opened this issue Jul 10, 2018 · 5 comments
Closed

git not found on windows even though its there #761

Datseris opened this issue Jul 10, 2018 · 5 comments

Comments

@Datseris
Copy link
Contributor

I am trying to create deploy keys for documenter. I am on windows and not on linux.

I have to say it is tremendously difficult. I have spend several hours now, and still had very little progress. The documentation is really not helpful for windows users, there is no information whatsoever.

So far I have tried to create keys using puttygen but travis hangs, requesting passphrase. Seems like the only way to create working keys is using documenter itself.

But that is impossible on windows:

julia> using Documenter

julia> Travis.genkeys("JuliaMusic_documentation")

 in module Travis
in #2 at C:\Users\datseris\.julia\packages\Documenter\eULE\src\Travis.jl
ERROR: 'git' not found.
Stacktrace:
 [1] error at .\error.jl:33 [inlined]
 [2] #genkeys#1(::String, ::Function, ::String) at C:\Users\datseris\.julia\packages\Documenter\eULE\src\Travis.jl:49
 [3] genkeys(::String) at C:\Users\datseris\.julia\packages\Documenter\eULE\src\Travis.jl:48
 [4] top-level scope at none:0

shell> git
usage: git [--version] [--help] [-C <path>] [-c name=value]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           <command> [<args>]

latest julia, latest documenter versions.

As a side note, I really have to express that this also makes me feel very unwelcomed: why would there be not a single sentence of support for someone that doesn't use linux? (in the documentation)

@fredrikekre
Copy link
Member

What is

shell> which git

@mortenpi
Copy link
Member

Is #567 any help? Otherwise, it would be a bit of a workaround, but could you run Julia in the Windows Linux subsystem? It is strange though.. you do seem to have git in PATH.

Some other comments:

  • I don't think the whole Travis thing should even rely on Git, since it just ssh-keygens and base64encodes IIRC (it used to do more). Alternatively, switching to LibGit2 (Switch over to LibGit2 #686) should also make this more cross-platform.

  • We should describe in the manual how the keys are generated, so that it would be relatively easy to manually create the keys if Travis.genkeys fails for whatever reason (like here).

  • Ideally though, Travis.genkeys would just work on Windows too.

As a side note, I really have to express that this also makes me feel very unwelcomed: why would there be not a single sentence of support for someone that doesn't use linux? (in the documentation)

Who uses Windows anyway? 😆 Joking aside, as far as I know, none of the current or past active devs really have any good access to Windows, hence the reason why Windows is a bit neglected (same actually applies to macOS, but since it's more similar to Linux, it need less special treatment). Right now, testing on Windows is usually just seeing if the AppVeyor builds pass.

All that said, the goal is that Documenter should Just Work (TM) on Windows and the relevant quirks should be documented. For that reason, contributions to the code and docs (but also issues like this) from Windows-based Documenter users are greatly appreciated.

@mortenpi
Copy link
Member

mortenpi commented Jul 11, 2018

As a workaround, as long as you have ssh-keygen available, you should be able to run these commands on Windows to get the keys:

julia> using Compat
shell> ssh-keygen -N "" -f privatekey
julia> read("privatekey", String) |> base64encode |>  println # this should become a secure environment variable on Travis called DOCUMENTER_KEY
julia> read("privatekey.pub", String) |> println # this should be added as a Deploy Key on GitHub (https://github.com/$user/$repo/settings/keys)

@Datseris
Copy link
Contributor Author

Datseris commented Jul 11, 2018

Hello!
@fredrikekre super weird:

shell> which git
which: no git in (/c/Program Files/ImageMagick-7.0.7-Q16:/c/Program Files/ImageMagick-7.0.4-Q16:/c/Windows/system32:/c/Windows:/c/Windows/System32/W
...
...

I don't know what this means to be honest.


@mortenpi nope, #567 was not of any help. In fact I followed the suggestions of that issue and was able to generate a key. The problem was that the key was hanging on travis, requesting passphrase (even though there wasn't any).


I have now created a deploy key, and it was fairly trivial. All I had to do is tell a friend of mine to run the command using Documenter; Travis.genkeys("thename"). It took them literally 5 seconds and it was all ok. I don't know why @fredrikekre was so prohibiting and insisting that I specifically should do it. It only made my experience with setting up documenter more stressful. A better suggestion would be "if you have a friend you can trust, it is much easier to have him generate it".

Once again: 5 second interaction.


All that said, the goal is that Documenter should Just Work (TM) on Windows and the relevant quirks should be documented. For that reason, contributions to the code and docs (but also issues like this) from Windows-based Documenter users are greatly appreciated.

Yes. My suggestion would be to put in the docs: "If you have a friend you can trust, ask them to do it for you". It is by far the easiest.

If you know of some other way that is guaranteed to make it work, and it is just as easy, please let me know, and I will tell other windows users that will certainly encounter this problem if they want to use Documenter.jl.


However, there is a deeper, fundamental problem here. I am not sure, but in the end of the day the process should be very simple: I should be able to "just generate a private-public key pair", anyway I want, in any OS I want, and upload them to the internet.

No?

I mean, why is it that only the keys generated with Travis.genkeys() work? Is it because of the base64encode?


p.s. documenter is amazing I hope my attitude is not making you think otherwise.



EDIT: OH WOW!!!! This magic piece of code:

julia> using Base64
shell> ssh-keygen -N "" -f privatekey
julia> read("privatekey", String) |> base64encode |>  println # this should become a secure environment variable on Travis called DOCUMENTER_KEY
julia> read("privatekey.pub", String) |> println # this should be added as a Deploy Key on GitHub (https://github.com/$user/$repo/settings/keys)

seems to work perfectly fine!!!!
Why not simply put this in the documentation, under the deploy section?

@mortenpi
Copy link
Member

mortenpi commented Sep 2, 2018

Closing this in favor of JuliaDocs/DocumenterTools.jl#5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants