Well, a few more notes on this, for the benefit of the readers.
I learned something new about… Bash? POSIX? Linux? Maybe it’s a stretch to say I learned anything if I don’t know what I learned it about. But, anyway, point is that if you use git inside a script, such as in this excerpt from force_push_comparison.bash:
#!/bin/bash
# SPDX-FileCopyrightText: © 2026 hashcatHitman
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
# SNIP! Lines omitted.
alice_commit() {
local alice_file="${1}"
local commit_id="${2}"
echo -e "${ALICE_COLOR}Alice adding commit ${commit_id}...${RESET}"
cd "${ALICE_CLONE_DIR}" || exit 1
echo "${alice_file}" >"${alice_file}.txt" || exit 1
git add "${alice_file}.txt" || exit 1
git commit -m "commit ${commit_id}: add ${alice_file}.txt" || exit 1
git push "${REMOTE}" || exit 1
}
# SNIP! Lines omitted.
The script does not inherit your aliases from your .bashrc. If you want to fix this, at least, in a Bash script (at least, in my case. You should verify on your own system rather than taking what I say as fact), you can either:
Export the TZ variable with the preferred timezone:
#!/bin/bash
# SPDX-FileCopyrightText: © 2026 hashcatHitman
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
export TZ='Etc/UTC'
# SNIP! Lines omitted.
alice_commit() {
local alice_file="${1}"
local commit_id="${2}"
echo -e "${ALICE_COLOR}Alice adding commit ${commit_id}...${RESET}"
cd "${ALICE_CLONE_DIR}" || exit 1
echo "${alice_file}" >"${alice_file}.txt" || exit 1
git add "${alice_file}.txt" || exit 1
git commit -m "commit ${commit_id}: add ${alice_file}.txt" || exit 1
git push "${REMOTE}" || exit 1
}
# SNIP! Lines omitted.
or prefix every command with the timezone you like:
#!/bin/bash
# SPDX-FileCopyrightText: © 2026 hashcatHitman
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
TZ='Etc/UTC'
# SNIP! Lines omitted.
alice_commit() {
local alice_file="${1}"
local commit_id="${2}"
echo -e "${ALICE_COLOR}Alice adding commit ${commit_id}...${RESET}"
cd "${ALICE_CLONE_DIR}" || exit 1
echo "${alice_file}" >"${alice_file}.txt" || exit 1
# In theory, you only actually need this in front of commands like `git commit`,
# `git rebase`, `git tag`, `git merge`, and so on. Better safe than sorry, in my
# opinion.
TZ="${TZ}" git add "${alice_file}.txt" || exit 1
TZ="${TZ}" git commit -m "commit ${commit_id}: add ${alice_file}.txt" || exit 1
TZ="${TZ}" git push "${REMOTE}" || exit 1
}
# SNIP! Lines omitted.
Between the two, I think you should prefer the former (exporting, to be clear), because if your script calls another script that also makes commits:
#!/bin/bash
# SPDX-FileCopyrightText: © 2026 hashcatHitman
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
# SNIP! Lines omitted.
alice_commit() {
local alice_file="${1}"
local commit_id="${2}"
echo -e "${ALICE_COLOR}Alice adding commit ${commit_id}...${RESET}"
cd "${ALICE_CLONE_DIR}" || exit 1
echo "${alice_file}" >"${alice_file}.txt" || exit 1
# In theory, you only actually need this in front of commands like `git commit`,
# `git rebase`, `git tag`, `git merge`, and so on. Better safe than sorry, in my
# opinion.
git add "${alice_file}.txt" || exit 1
git commit -m "commit ${commit_id}: add ${alice_file}.txt" || exit 1
git push "${REMOTE}" || exit 1
}
./script_that_does_some_git_stuff.bash
# SNIP! Lines omitted.
It inherits the exported TZ.
That all being said, I’ve ultimately decided that the best way to avoid leaking your timezone is to just change the timezone on your entire system. On KDE, you can configure your taskbar clock to show a different timezone anyway (just be careful not to leak it through the configuration files/screenshots if you do). I haven’t figured out how to do that with the lock screen clock. You should probably change your timezone through your GUI settings manager (assuming your DE has one) to make sure it changes any extra things it might need to.
I’ve switched to using Etc/UTC for TZ related purposes instead of something like UTC0 because:
Etc/UTC is actually listed by timedatectl list-timezones
- On Tails,
/etc/localtime is a symbolic link to /usr/share/zoneinfo/Etc/UTC
So while they should generally be equivalent, Etc/UTC feels more “correct” to me.