cannot git clone into /usr/ports when separate filesystem

Michael Gmelin freebsd at grem.de
Tue Apr 6 12:02:28 UTC 2021



> On 6. Apr 2021, at 13:10, Marco Beishuizen <mbeis.bsd at xs4all.nl>
> wrote:
> 
> Hi,
> 
> I'm trying to git clone the portstree into /usr/ports. /usr/ports is
> a separate filesystem so it contains a .sujournal file. But now git
> complains "fatal: destination path 'ports' already exists and is not
> an empty directory."
> 
> So my question is what to do next? Recreating a new .sujournal every
> time a ports tree needs to be cloned is quite annoying.

Like Felix wrote, you clone exactly once and then you only pull for
updates.

Assuming /usr/ports is empty besides the .sujournal file, I would do:

  cd /usr/ports
  git clone https://git.freebsd.org/ports.git removeme
  mv removeme/.* removeme/* .
  rmdir removeme
  git status
  git pull

Note that "Invalid Arguments" errors are expected on the mv command
(this could be replaced by a fancy find command, like `find removeme \
-mindepth 1 -maxdepth 1 -exec mv {} . \;`, but this was easier).

Also, in case "git status" shows something like "Untracked filed
.sujournal", add ".sujournal" to your global git excludes file.

Example:

  git config core.excludesFile=$HOME/.gitexcludes
  echo .sujournal >>$HOME/.gitexcludes

In case you don't want to override the excludesFile setting, alter one
of the config files in the default global location
$XDG_CONFIG_HOME/git/ignore[0].

Best,
Michael

[0] `man git-config` says:
   core.excludesFile
       Specifies the pathname to the file that contains patterns to
       describe paths that are not meant to be tracked, in addition
       to .gitignore (per-directory) and .git/info/exclude. Defaults to
       $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either
       not set or empty, $HOME/.config/git/ignore is used instead. See
       gitignore(5).


More information about the freebsd-ports mailing list