PkgTemplates.jl icon indicating copy to clipboard operation
PkgTemplates.jl copied to clipboard

"Git hosting service username is required"

Open ma-laforge opened this issue 3 years ago • 4 comments

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/or user.email settings in my .gitconfig - but this appears to be something else.
  • After a bit of searching around, I found the help on Template mentioned the github.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.

ma-laforge avatar Nov 06 '21 03:11 ma-laforge

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.

terasakisatoshi avatar Dec 04 '21 07:12 terasakisatoshi

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?

a2k42 avatar Mar 19 '23 17:03 a2k42

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.

a2k42 avatar Mar 19 '23 19:03 a2k42

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 theTemplate constructor, or you must set git config ...

This should be a nice easy first PR for someone

oxinabox avatar Mar 20 '23 01:03 oxinabox