How can I change git timezone offset?

I read that the -date argument when adding a commit can be used to specify a timestamp and timezone offset. I am curious if there is a way to globally set only the time zone offset so that it matches my time zone. I am in EST, which is -0500 from UTC, and whenever I commit and click on Github, my contributions never appear on the correct day. IE it's 2:00 AM where I am, but git sets the timezone offset to UTC. Now, when I make / click my changes on Github, they will appear in the format of 9 pm UTC.

Now I have a little OCD.

+6
source share
1 answer

Git gets the time zone from your system configuration, so if you configured your system correctly, then Git must use the correct time zone. Run date +%z to check your system configuration.

Git may be using the correct time zone, but GitHub will display the time using the wrong time zone. After creating the commit, run git show and check the offset. If this is correct, then the problem is with GitHub.

+1
source

Source: https://habr.com/ru/post/976760/


All Articles