# Bug? Local server environment gets deployed to server

**URL:** <https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932>\
**Category:** support\
**Created:** [July 29, 2024, 11:47pm UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932 "2024-07-29T23:47:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamescridland](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jamescridland/32/15901_2.png) [@jamescridland](https://discourse.gohugo.io/u/jamescridland)\
**Post date:** [July 29, 2024, 11:47pm UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932/1 "2024-07-29T23:47:15Z")

</div>

I don’t know if this is intended behaviour, but…

If I use `hugo server` to run a local development server, and then do `hugo deploy` straight after that, then Hugo re-uploads the full site’s code, including RSS feeds, with direct links to `http://localhost:1313...`

This, of course, breaks things.

Expected behaviour would be that `hugo deploy` would never deploy the `localhost` environment variables.

Running my usual `hugo && hugo deploy` works as expected, with correct links to my domain.

Is this intended behaviour, a config file mistake, or a very stupid user? (It’s probably the latter)

---

<div class="post-metadata">

**Author:** ![CyrusYip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cyrusyip/32/20786_2.png) [@CyrusYip](https://discourse.gohugo.io/u/CyrusYip)\
**Post date:** [July 30, 2024, 12:20am UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932/2 "2024-07-30T00:20:06Z")

</div>

> The hugo server command will by default write and serve files from disk, but you can render to memory by using the --renderToMemory flag.

> **[hugo server](https://gohugo.io/commands/hugo_server/)**
>
> hugo server A high performance webserver
> Synopsis Hugo provides its own webserver which builds and serves the site. While hugo server is high performance, it is a webserver with limited options.
> The hugo server command will by default write and serve...

---

<div class="post-metadata">

**Author:** ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)\
**Post date:** [July 30, 2024, 8:00am UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932/3 "2024-07-30T08:00:02Z")

</div>

You alsl could use different publishDir when calling hugo server.

Or use hugo environments (development/production) to define that in config. With that you don’t need to be vigliant every time on the commandline

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 30, 2024, 9:07am UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932/4 "2024-07-30T09:07:33Z")

</div>

> [@CyrusYip](#):
>
> to memory by using the --renderToMemory flag.

There’s a shorthand for that flag, so you can do

```auto
hugo server -M

```

---

<div class="post-metadata">

**Author:** ![jamescridland](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jamescridland/32/15901_2.png) [@jamescridland](https://discourse.gohugo.io/u/jamescridland)\
**Post date:** [July 30, 2024, 10:24pm UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932/5 "2024-07-30T22:24:44Z")

</div>

Thanks. So for clarity - are we saying “this is the bug that causes this”, or “this is intended behaviour”?

I’m not sure it should work this way.

---

<div class="post-metadata">

**Author:** ![CyrusYip](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/cyrusyip/32/20786_2.png) [@CyrusYip](https://discourse.gohugo.io/u/CyrusYip)\
**Post date:** [July 30, 2024, 10:36pm UTC](https://discourse.gohugo.io/t/bug-local-server-environment-gets-deployed-to-server/50932/6 "2024-07-30T22:36:42Z")

</div>

It’s intended behavior.
