Error in creating a package using PkgTemplates.jl

Hi,
I would lile to learn to creat a package using PkgTemplates.jl
When I try it according to the User Guilde:

using PkgTemplates
t = Template()
t(“MyPkg”)

It has the following error:
Git: Git hosting service username is required, set one with keyword user="<username>"
I don’t why and I need some help. Thank you.

t("MyPkg"; user = "zoumuda")

https://invenia.github.io/PkgTemplates.jl/stable/user/#PkgTemplates.Template

Thank you for your help.

Hi Zoumuda,

I have tried:

using PkgTemplates
t(“MyPkg”; user= “bdvalqui”)

and I got the following error:
ERROR: UndefVarError: t not defined
Stacktrace:
[1] top-level scope at none:1

How did you solve your issue? Thanks.

I recommend using the generate_interactive("MyPkg"), it should really be the first option in the PkgTemplates.jl’s README. I will submit a PR…

I keep getting this on Julia 1.7.1

julia> generate_interactive("Junk")
Template keywords to customize:
[press: d=done, a=all, n=none]
 > [X] user
   [ ] authors
   [ ] dir
   [ ] host
   [ ] julia
   [ ] plugins
Enter value for 'user' (String, required): me
ERROR: ArgumentError: Git: Global Git config is missing required value 'user.name'
Stacktrace:
  [1] (::PkgTemplates.var"#69#70"{Git})(k::Symbol)
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\plugins\git.jl:54
  [2] foreach
    @ .\abstractarray.jl:2694 [inlined]
  [3] validate(p::Git, t::Template)
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\plugins\git.jl:51
  [4] (::PkgTemplates.var"#9#15"{Template})(p::Git)
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:113
  [5] foreach(f::PkgTemplates.var"#9#15"{Template}, itr::Vector{PkgTemplates.Plugin})
    @ Base .\abstractarray.jl:2694
  [6] Template(::Val{false}; kwargs::Base.Pairs{Symbol, SubString{String}, Tuple{Symbol}, NamedTuple{(:user,), Tuple{SubString{String}}}})
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:113
  [7] #Template#1
    @ C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:81 [inlined]
  [8] interactive(::Type{Template}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:202
  [9] interactive(::Type{Template})
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:180
 [10] Template(::Val{true}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ PkgTemplates C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:82
 [11] Template
    @ C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:82 [inlined]
 [12] #Template#1
    @ C:\Users\madsenbj\.julia\packages\PkgTemplates\NibYy\src\template.jl:81 [inlined]
 [13] generate_interactive(pkg::String)
    @ PkgTemplates .\deprecated.jl:72
 [14] top-level scope
    @ REPL[9]:1

I am having this issue too on Julia 1.8.2.
Tried git config --global user.name myname in terminal,
and also generate_interactive and Template(interactive=true) approach in Julia shell, but still facing same ArgumentError.

You can use
using PkgTemplates
t = Template(; user="<your github username>")
t("<your package name>")

1 Like