running makedocs locally fails with repo/remotes unset
I am wondering what the correct way is to just run makedocs locally, ie in a git repository that is not present on Github or any similar service. I just want the docs in docs/build.
When using Documenter.jl 1.7, invoking
using Documenter, Foo
makedocs(
modules = [Foo],
format = Documenter.HTML(; prettyurls = get(ENV, "CI", nothing) == "true"),
authors = "Tamás K. Papp",
sitename = "Foo.jl",
pages = Any["index.md"])
gives me the error
tamas@tamas /tmp/test/Foo % julia --startup-file=no --project=docs --color=yes docs/make.jl
┌ Warning: Unable to determine HTML(edit_link = ...) from remote HEAD branch, defaulting to "master".
│ Calling `git remote` failed with an exception. Set JULIA_DEBUG=Documenter to see the error.
│ Unless this is due to a configuration error, the relevant variable should be set explicitly.
└ @ Documenter ~/.julia/packages/Documenter/C1XEF/src/utilities/utilities.jl:640
ERROR: LoadError: ArgumentError: Unable to automatically determine remote for main repo.
> `repo` is not set, and the Git repository has invalid origin.
Configure `repo` and/or `remotes` appropriately, or set `remotes = nothing` to disable remote source
links altogether (e.g. if not working in a Git repository).
path: /tmp/test/Foo
Stacktrace:
[1] interpret_repo_and_remotes(; root::String, repo::String, remotes::Dict{Any, Any})
@ Documenter ~/.julia/packages/Documenter/C1XEF/src/documents.jl:646
[2] interpret_repo_and_remotes
@ ~/.julia/packages/Documenter/C1XEF/src/documents.jl:505 [inlined]
[3] Documenter.Document(; root::String, source::String, build::String, workdir::Symbol, format::Documenter.HTMLWriter.HTML, clean::Bool, doctest::Bool, linkcheck::Bool, linkcheck_ignore::Vector{Any}, linkcheck_timeout::Int64, linkcheck_useragent::String, checkdocs::Symbol, checkdocs_ignored_modules::Vector{Module}, doctestfilters::Vector{Regex}, warnonly::Vector{Symbol}, modules::Vector{Module}, pages::Vector{Any}, pagesonly::Bool, expandfirst::Vector{String}, plugins::Vector{Documenter.Plugin}, repo::String, remotes::Dict{Any, Any}, sitename::String, authors::String, version::String, highlightsig::Bool, draft::Bool, others::@Kwargs{})
@ Documenter ~/.julia/packages/Documenter/C1XEF/src/documents.jl:433
[4] #makedocs#87
@ ~/.julia/packages/Documenter/C1XEF/src/makedocs.jl:266 [inlined]
[5] top-level scope
@ /tmp/test/Foo/docs/make.jl:5
in expression starting at /tmp/test/Foo/docs/make.jl:5
or set
remotes = nothingto disable remote source links altogether (e.g. if not working in a Git repository).
Does this suggestion from the error message work?
It does, but I should have mentioned: if possible, I want to use a solution that will also work when I put the packages on Github (eventually). Adding remotes = nothing would require that I remove it later --- feasible, but a bit tedious and I may forget about doing it.
Is there a solution with an environment variable? That I could set in the script that does the building.
What about this hack?
repo = Documenter.Remotes.GitHub("TBA", "Foo.jl")
I've submitted a pull request #2616 to mention in the user guide that you need the keyword argument remotes=nothing when running makedocs for a local package without a git remote.