# Incorrect .Lastmod (:git) date when deploying using Github Pages

**URL:** <https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900>\
**Category:** support\
**Created:** [October 11, 2022, 7:27pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900 "2022-10-11T19:27:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![plundration](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/plundration/32/17935_2.png) [@plundration](https://discourse.gohugo.io/u/plundration)\
**Post date:** [October 11, 2022, 7:27pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/1 "2022-10-11T19:27:38Z")

</div>

Hello, I am having a problem with using `.Lastmod`.

**I expect it** to return the date given by `":git"` so `.GitInfo.AuthorDate`, (because I have it set in config.toml) which is **exactly what it does** when I use `hugo server` or run the command `hugo --minify --cleanDestinationDir --gc` dirrectly and host it as a live-server.

**However** when I build it and deploy it to Github Pages using Github Actions, it instead **shows some other date** (for some it is the current day and others 01 Jan 01.

[My repo](https://github.com/plundration/plundration.github.io/)

Dates on my site: [link](https://plundration.github.io)  
Dates using hugo server:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/2/0/20f0d18a7796004752c55f00251d8fdc250ee1b0.png)

Relevant job in workflow:

```auto
jobs:
  deploy:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v3
        with:
          fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

      - name: Setup Hugo
        uses: peaceiris/actions-hugo@v2
        with:
          hugo-version: 'latest'
          extended: true

      - name: Build
        run: hugo --minify --cleanDestinationDir --gc

      - name: Deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./public
          publish_branch: master # deploying branch
          cname: plundration.github.io/

```

Code for getting the date:

```auto
{{.Lastmod.Format "02 Jan 06"}}

```

Lastmod config:

```auto
...

enableGitInfo = true
[frontmatter]
    lastmod = [":git"]

...

```

Versions:

```auto
hugo v0.104.2+extended linux/amd64 BuildDate=unknown
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.19.1"

git version 2.37.3

```

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 11, 2022, 8:06pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/2 "2022-10-11T20:06:07Z")

</div>

I think you’re running into this issue:  
[https://github.com/gohugoio/hugo/issues/9810](https://github.com/gohugoio/hugo/issues/9810)

In your _local_ git configuration, what is the value of `core.quotepath`?

---

<div class="post-metadata">

**Author:** ![plundration](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/plundration/32/17935_2.png) [@plundration](https://discourse.gohugo.io/u/plundration)\
**Post date:** [October 11, 2022, 8:08pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/3 "2022-10-11T20:08:37Z")

</div>

It is set to false

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 11, 2022, 8:09pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/4 "2022-10-11T20:09:17Z")

</div>

So you need to do the same with your GH deployment.

[https://github.com/gohugoio/hugo/issues/9810#issuecomment-1107519804](https://github.com/gohugoio/hugo/issues/9810#issuecomment-1107519804)

---

<div class="post-metadata">

**Author:** ![plundration](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/plundration/32/17935_2.png) [@plundration](https://discourse.gohugo.io/u/plundration)\
**Post date:** [October 11, 2022, 8:16pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/5 "2022-10-11T20:16:29Z")

</div>

I’m not able to find the correct syntax for the workflow…  
Also can’t find it in the workflow in the github pages repo mentioned in the issue.

**EDIT** : im asssuming that git config isn’t shared with remote

---

<div class="post-metadata">

**Author:** ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)\
**Post date:** [October 11, 2022, 8:21pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/6 "2022-10-11T20:21:50Z")

</div>

Here’s the GH workflow from the example repo:  
[https://github.com/jmooring/hugo-stork/blob/main/.github/workflows/gh-pages.yml#L26-L27](https://github.com/jmooring/hugo-stork/blob/main/.github/workflows/gh-pages.yml#L26-L27)

And here are the relevant lines from the build script:  
[https://github.com/jmooring/hugo-stork/blob/main/build.sh#L27-L32](https://github.com/jmooring/hugo-stork/blob/main/build.sh#L27-L32)

You can just add this directly to your workflow as an additional step:

```bash
git config --global core.quotepath false

```

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [October 13, 2022, 8:22pm UTC](https://discourse.gohugo.io/t/incorrect-lastmod-git-date-when-deploying-using-github-pages/40900/7 "2022-10-13T20:22:19Z")

</div>

Closed on October 13, 2022, 8:22pm UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
