PkgTemplates.jl
PkgTemplates.jl copied to clipboard
"Git hosting service username is required"
Hi. I'm just trying out PkgTemplates.jl in an attempt to master some of the more advanced package features - but ran into some difficulties.
New user's perspective
On my first attempt at using PkgTemplates.jl, I followed the instructions @ https://invenia.github.io/PkgTemplates.jl/stable/user/:
julia> using PkgTemplates
julia> t=Template()
ERROR: Git: Git hosting service username is required, set one with keyword `user="<username>"`
I was very surprised to see an error message so early on.
New user's perspective
I am mostly familiar with Git, but I did not understand this message.
- I thought this meant I did not setup my (global)
user.name
and/oruser.email
settings in my.gitconfig
- but this appears to be something else. - After a bit of searching around, I found the
help
onTemplate
mentioned thegithub.user
setting. Before that instant, I was unaware that.gitconfig
could store github-specific parameters. - In retrospect, I can see that the error message was hinting I could specify the user parameter in my call to
Template()
- but in my mind, it sounded like I needed to add something to my.gitconfig
directly.
I get that PkgTemplates.jl is meant to simplify the configuration of Julia's more advanced package features. As such, it might well be targeting more advanced users. Nonetheless, I sort of feel like some background might be missing from the User Guide.
Setting github.user
before running t = Template()
solves our issue.
$ git config --global github.user <your-github-account>
There is yet another solution by setting user=<your-github-account>
i.e.
julia> using PkgTemplates
julia> t = Template(user="<your-github-account>")
See the docstring of Template
help?> Template
search: Template PkgTemplates interactive_template
Template(; kwargs...)
A configuration used to generate packages.
Keyword Arguments
===================
User Options
––––––––––––––
• user::AbstractString="": GitHub (or other code hosting service)
username. The default value comes from the global Git config
(github.user). If no value is obtained, many plugins that use this value
will not work.
I understand that you can add github.user
to your global config. For me the confusion came from having never used this setting before and having never heard of it, and I've been on GitHub for years.
What would be useful is a link to the source of this setting, perhaps documentation on GitHub, that describes the use of this setting. If it has been invented for use with PkgTemplates then making this clear in the documentation would save some time and confusion trying to find it's meaning / normal usage.
Was there a reason not to use user.name
as the default?
Related? https://github.com/JuliaCI/PkgTemplates.jl/issues/226
The README for this repo has some useful extra information too but I didn't see it to start because I was looking at the main document site.
I think most users should be passing in the user name (since that also works for github orgs), so we should at least point that out in the error message. With something like
You must either pass in the
userargument to the
Template constructor, or you must set git config ...
This should be a nice easy first PR for someone