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

running makedocs locally fails with repo/remotes unset #2585

Open
tpapp opened this issue Oct 3, 2024 · 5 comments
Open

running makedocs locally fails with repo/remotes unset #2585

tpapp opened this issue Oct 3, 2024 · 5 comments

Comments

@tpapp
Copy link
Contributor

tpapp commented Oct 3, 2024

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
@fredrikekre
Copy link
Member

or set remotes = nothing to disable remote source links altogether (e.g. if not working in a Git repository).

Does this suggestion from the error message work?

@tpapp
Copy link
Contributor Author

tpapp commented Oct 3, 2024

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.

@tpapp
Copy link
Contributor Author

tpapp commented Oct 3, 2024

Is there a solution with an environment variable? That I could set in the script that does the building.

@kalvotom
Copy link
Contributor

What about this hack?

  repo = Documenter.Remotes.GitHub("TBA", "Foo.jl")

@zengmao
Copy link
Contributor

zengmao commented Dec 30, 2024

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.

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

No branches or pull requests

4 participants