cannot git clone into /usr/ports when separate filesystem

Michael Gmelin freebsd at grem.de
Tue Apr 6 13:29:22 UTC 2021



On Tue, 6 Apr 2021 15:12:42 +0200 (CEST)
freebsd at oldach.net (Helge Oldach) wrote:

> Marco Beishuizen wrote on Tue, 06 Apr 2021 14:25:51 +0200 (CEST):
> > On Tue, 6 Apr 2021, the wise Helge Oldach wrote:  
> > > cd /usr/ports
> > > git init .
> > > git remote add -t main -f freebsd
> > > https://git.freebsd.org/ports.git  
> > 
> > This created new .git subdirectories but still cannot clone into 
> > /usr/ports.  
> 
> Sorry, I forgot: git checkout main
> 
> Once done, just regularly: git pull --ff-only
> 
> Explanation: "clone" is roughly equivalent to "init + remote add +
> checkout". Separating the three steps will allow for the -f (--force)
> option on "remote add" which will ignore already existing files.
> 

Kind of re-sending what I wrote earlier, as I managed to have diverging
HTML and plain text alternatives in my previous email (facepalm).

I wouldn't bother to get all these details right and instead just clone
somewhere else and move files into place, e.g.:

  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