The error can be reproduced (after starting with 'emacs -Q') by running:

(require 'tramp)

This produces the error message:

Debugger entered--Lisp error: (file-missing "Setting current directory" "No such file or directory" "/build/emacs-snapshot-zZJlNJ/emacs-snapshot-201811...")
  call-process("git" nil (t nil) nil "rev-parse" "--abbrev-ref" "HEAD")
  emacs-repository-branch-git("/build/emacs-snapshot-zZJlNJ/emacs-snapshot-201811...")
  emacs-repository-get-branch(nil)
  byte-code("\3011\21\0\302\30\303\304\305\306!\307\"!)0\207\210\310\207" [inhibit-message (error) t emacs-repository-get-branch locate-dominating-file locate-library "tramp" ".git" nil] 4)
  (defconst tramp-repository-branch (byte-code "\3011\21\0\302\30\303\304\305\306!\307\"!)0\207\210\310\207" [inhibit-message (error) t emacs-repository-get-branch locate-dominating-file locate-library "tramp" ".git" nil] 4) ("/usr/share/emacs/27.0.50/lisp/net/trampver.elc" . 601))
  require(trampver)
  byte-code("\300\301!\210\300\302!\210\300\303!\210\304\305\306\307\310\311\310\312\313\314\315\316&\13\210\317\320\321\322\323DD\324\310\305\325\326&\7\210\317\327\321\322\330DD\331..." [require tramp-compat trampver cl-lib custom-declare-group tramp nil "Edit remote files with a combination of ssh, scp, ..." :group files comm :link (custom-manual "(tramp)Top") :version "22.1" custom-declare-variable tramp-mode funcall function #f(compiled-function () #<bytecode 0x13d8e7d>) "Whether Tramp is enabled.\nIf it is set to nil, all..." :type boolean tramp-verbose #f(compiled-function () #<bytecode 0x13d8e89>) "Verbosity level for Tramp messages.\nAny level x in..." integer tramp-backup-directory-alist #f(compiled-function () #<bytecode 0x13d8e95>) "Alist of filename patterns and backup directory na..." (repeat (cons (regexp :tag "Regexp matching filename") (directory :tag "Backup directory name"))) tramp-auto-save-directory #f(compiled-function () #<bytecode 0x13d8ea1>) "Put auto-save files in this directory, if set.\nThe..." (choice (const :tag "Use default" nil) (directory :tag "Auto save directory name")) tramp-encoding-shell #f(compiled-function () #<bytecode 0x13d8eb5>) "Use this program for encoding and decoding command..." (file :must-match t) tramp-encoding-command-switch #f(compiled-function () #<bytecode 0x13d8ecd>) "Use this switch together with `tramp-encoding-shel..." string tramp-encoding-command-interactive #f(compiled-function () #<bytecode 0x13d8ee1>) "Use this switch together with `tramp-encoding-shel..." "24.1" (choice (const nil) string)] 12)
  require(tramp)
  eval((require 'tramp) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
command-execute(eval-last-sexp)


The issue can be traced to the definition of tramp-repository-branch in
trampver.el. This calls:

(emacs-repository-get-branch
(locate-dominating-file (locate-library "tramp") ".git"))

However, (locate-dominating-file (locate-library "tramp") ".git")
evaluates to nil, meaning that above is equivalent to
(emacs-repository-get-branch nil).

This causes the function emacs-repository-get-branch (in version.el) to
rely on the variable source-directory i.e. which references the source directory where the emacs
binary was built, which of course does not exist on an end user's system.



In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.1)
 of 2018-11-11, unofficial emacs-snapshot build: http://emacs.secretsauce.net built on lilbastard
Windowing system distributor 'The X.Org Foundation', version 11.0.12003000
System Description: Debian GNU/Linux buster/sid

Recent messages:
Waiting for git...
Entering debugger...
Mark set
Back to top level
uncompressing trampver.el.gz...done
Note: file is write protected
Quit
Mark set
Quit
Mark activated

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/lib
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/27.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.0.50/site-lisp:/usr/share/emacs/site-lisp
 --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/lib --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes
 --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/27.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/27.0.50/site-lisp:/usr/share/emacs/site-lisp
 --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars
 'CFLAGS=-g -O2
 -fdebug-prefix-map=/build/emacs-snapshot-zZJlNJ/emacs-snapshot-20181111+emacs-26.1-3391-ga004d3bbbae=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall -fno-omit-frame-pointer'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LCMS2 GMP

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs time-date mm-decode mm-bodies mm-encode mail-parse
rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045
ietf-drums mm-util mail-prsvr mail-utils jka-compr thingatpt help-fns
radix-tree cl-print debug backtrace help-mode easymenu find-func
tramp-compat tramp-loaddefs ucs-normalize shell pcomplete comint
ansi-color ring parse-time format-spec advice auth-source cl-seq eieio
eieio-core cl-macs eieio-loaddefs password-cache json map seq byte-opt
gv bytecomp byte-compile cconv cl-loaddefs cl-lib elec-pair mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)

Memory information:
((conses 16 225554 12946)
 (symbols 48 22184 1)
 (strings 32 34717 2545)
 (string-bytes 1 968285)
 (vectors 16 38460)
 (vector-slots 8 767680 15958)
 (floats 8 51 275)
 (intervals 56 852 6)
 (buffers 992 13))