# Deploy Documenter docs locally

**URL:** <https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463>\
**Category:** General Usage\
**Tags:** documentation, documenter, git\
**Created:** [August 19, 2017, 3:46pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463 "2017-08-19T15:46:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [August 19, 2017, 3:46pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/1 "2017-08-19T15:46:45Z")

</div>

As I understand it, the function `deploydocs` in `Documenter.jl` is designed to work with travis only. I have a private repository I would like to generate documentation for, and would like a `deploydocs` function that could deploy my generated documentation when run on my local machine. Anyone having accomplished this before and have some insight/experiences on a nice approach?

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [August 19, 2017, 3:58pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/2 "2017-08-19T15:58:11Z")

</div>

If you’re using MkDocs (the default, instead of native HTML), you can simply run the following in the `docs` directory:

```julia
julia make.jl
mkdocs serve

```

This is assuming you have [MkDocs installed](http://www.mkdocs.org/#installation), as well as any Python packages you’ve listed in your `deploydocs` call. Actually, you can keep the server running and only run `julia make.jl`, as the server will detect the changes and auto-reload and refresh your browser.

If you’re using native HTML, simply open the generated HTML files.

---

<div class="post-metadata">

**Author:** ![baggepinnen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/baggepinnen/32/693_2.png) [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Post date:** [August 19, 2017, 4:09pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/3 "2017-08-19T16:09:41Z")

</div>

Thanks! That seems to be working well.  
I would also be interested in automatic deployment to a git branch, e.g., `gh-pages` as `deploydocs` does.

---

<div class="post-metadata">

**Author:** ![cstook](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstook/32/3731_2.png) [@cstook](https://discourse.julialang.org/u/cstook)\
**Post date:** [August 19, 2017, 4:09pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/4 "2017-08-19T16:09:43Z")

</div>

I created a short julia script to set the environment variables the way travis would set them. Need to keep this outside the repository since it contains the deploy key.

```julia
ENV["TRAVIS_REPO_SLUG"] = "github.com/cstook/LTspice.jl.git"
ENV["TRAVIS_PULL_REQUEST"] = "false"
ENV["TRAVIS_OS_NAME"] = "linux"
ENV["TRAVIS_JULIA_VERSION"] = "0.6"
ENV["TRAVIS_TAG"] = "master"
ENV["DOCUMENTER_KEY"] = key not shown

```

Then modify the make.jl file to include this script is it exists.

```julia
if "deploy" in ARGS
  fake_travis = "C:/Users/Chris/fake_travis_LTspice.jl"
  if isfile(fake_travis)
    include(fake_travis)
  end
  deploydocs(
    repo = "github.com/cstook/LTspice.jl.git",
    target = "site",
    branch = "gh-pages",
    latest = "master",
    osname = "linux",
    julia = "0.6",
    deps = nothing,
    make = nothing,
  )
end

```

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [August 19, 2017, 4:35pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/5 "2017-08-19T16:35:47Z")

</div>

Haven’t tried this, but in theory [`mkdocs gh-deploy`](http://www.mkdocs.org/user-guide/deploying-your-docs/) should work.

---

<div class="post-metadata">

**Author:** ![dpo](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dpo/32/3335_2.png) [@dpo](https://discourse.julialang.org/u/dpo)\
**Post date:** [June 2, 2019, 4:16pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/7 "2019-06-02T16:16:24Z")

</div>

@cstook Many thanks for this! I found I had to make a few changes, presumably because Documenter has changed in the meantime:

```julia
# contents of faketravis.jl
ENV["TRAVIS_REPO_SLUG"] = "github.com/USER_NAME/PROJECT_NAME.jl.git"
ENV["TRAVIS_PULL_REQUEST"] = "false"
ENV["TRAVIS_OS_NAME"] = "macos" # or "linux"
ENV["TRAVIS_JULIA_VERSION"] = "1.1"
ENV["TRAVIS_TAG"] = ""
ENV["TRAVIS_BRANCH"] = "master"
ENV["DOCUMENTER_KEY"] = "..." # insert private key and add public key to Github project

```

and in `make.jl`:

```julia
if "deploy" in ARGS
  include("../../faketravis.jl")
end

deploydocs(deps = nothing, make = nothing,
  repo = "github.com/USER_NAME/PROJECT_NAME.jl.git",
  target = "build",
  branch = "gh-pages",
  devbranch = "master",
)

```

Issuing `julia make.jl deploy` builds and deploys the docs. Perfect for projects that depend on proprietary software.

---

<div class="post-metadata">

**Author:** ![a5sk6n](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/a5sk6n/32/34716_2.png) [@a5sk6n](https://discourse.julialang.org/u/a5sk6n)\
**Post date:** [September 24, 2025, 9:09pm UTC](https://discourse.julialang.org/t/deploy-documenter-docs-locally/5463/8 "2025-09-24T21:09:28Z")

</div>

Sorry for resurfacing this old thread but I had the same question and came up with a solution that does not rely on setting environment variables or so. I have written it down here:

```julia-auto
http://a5s.eu/blog/documenter-local-deploy/

```

(apparently I can’t post links)
