How to create a tar file that omits timestamps for its contents?

To have a truly idempotent tar, mtime is a good step but not enough.
You also need to set the sort order, the owner and group (together with their mapping) and a proper timezone for mtime (since otherwise you’re gonna have issues as well between Mac and Linux).

I ended up with

tar --sort=name --owner=root:0 --group=root:0 --mtime="UTC 2019-01-01" ... | gzip -n

Leave a Comment