Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Apr 2021 15:28:53 +0200
From:      Michael Gmelin <freebsd@grem.de>
To:        freebsd@oldach.net (Helge Oldach)
Cc:        mbeis.bsd@xs4all.nl, freebsd-ports@freebsd.org
Subject:   Re: cannot git clone into /usr/ports when separate filesystem
Message-ID:  <20210406152853.11f43bdc@bsd64.grem.de>
In-Reply-To: <202104061312.136DCggM012531@nuc.oldach.net>
References:  <c0e43b7-20a4-1ba1-c7cf-3a2f95f9bd3@xs4all.nl> <202104061312.136DCggM012531@nuc.oldach.net>

next in thread | previous in thread | raw e-mail | index | archive | help


On Tue, 6 Apr 2021 15:12:42 +0200 (CEST)
freebsd@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).





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210406152853.11f43bdc>