@@ -168,10 +168,11 @@ influence ``build``, ``tar`` and ``zip``. Examples:
168168Version Tagging
169169---------------
170170
171- The binaries are "tagged" with a version derived from the current Git commit
172- (or the ``RELEASE `` file, see below) and the current username and hostname.
173- The username and hostname can be overridden by the ``BUILD_USER `` and
174- ``BUILD_HOST `` environment variables, for example::
171+ The binaries are "tagged" with a version derived from the current Git commit,
172+ the most recent Git tag, and the current username and hostname. The Git commit
173+ and tag can be replaced by a ``RELEASE `` file; see below. The username and
174+ hostname can be overridden by the ``BUILD_USER `` and ``BUILD_HOST `` environment
175+ variables, for example::
175176
176177 $ BUILD_USER=builder BUILD_HOST=buildhost.local go run build.go
177178 $ ./bin/syncthing --version
@@ -180,6 +181,24 @@ The username and hostname can be overridden by the ``BUILD_USER`` and
180181In addition the timestamp (by default taken from the current Git commit) can
181182be overridden by the ``SOURCE_DATE_EPOCH `` variable, in Unix epoch seconds.
182183
184+ .. note ::
185+ If your built binary fails with an ``Invalid version string `` error, you
186+ probably did not fetch the Git tags with the code. This can happen when
187+ forking the repository on GitHub if you select the option to "Copy the
188+ ``main `` branch only". To fetch the tags on a fork, run these commands:
189+
190+ .. code-block :: bash
191+
192+ # Add the upstream repository as a remote
193+ $ git remote add upstream https://github.com/syncthing/syncthing.git
194+
195+ # Fetch all tags from the upstream remote
196+ $ git fetch --tags upstream
197+
198+ # Rebuild
199+ $ go run build.go
200+
201+
183202 Building without Git
184203--------------------
185204
0 commit comments