Date: Tue, 6 Apr 2021 19:25:05 +0200 From: Michael Gmelin <freebsd@grem.de> To: Jose Quinteiro <freebsd@quinteiro.org> Cc: freebsd-ports@freebsd.org Subject: Re: cannot git clone into /usr/ports when separate filesystem Message-ID: <20210406192505.5925243d@bsd64.grem.de> In-Reply-To: <638e4886-2d38-23df-c29a-923247d7b5fc@quinteiro.org> References: <c0e43b7-20a4-1ba1-c7cf-3a2f95f9bd3@xs4all.nl> <202104061312.136DCggM012531@nuc.oldach.net> <20210406152853.11f43bdc@bsd64.grem.de> <638e4886-2d38-23df-c29a-923247d7b5fc@quinteiro.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Jose, On Tue, 6 Apr 2021 08:33:27 -0700 Jose Quinteiro <freebsd@quinteiro.org> wrote: > On 4/6/21 6:28 AM, Michael Gmelin wrote: > > 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]. > > > The default name for these files is .gitignore. A file with that name > in your home directory will be honored in all git repositories with no > further configuration. This information is not correct. Example: [root@testhost /usr/ports]# cat $HOME/.gitconfig [user] email = freebsd@grem.de name = Michael Gmelin [root@testhost /usr/ports]# cat $HOME/.gitignore t.ignoreme [root@testhost /usr/ports]# touch t.ignoreme [root@testhost /usr/ports]# git status On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) t.ignoreme nothing added to commit but untracked files present (use "git add" to track) [root@testhost /usr/ports]# Oh no! > > A file called .gitignore in the current directory will add and/or > override patterns to/in the global .gitignore in your home directory. > See > > https://git-scm.com/docs/gitignore You link to the correct man page. This man page describes the behavior perceived in the example above accurately though (and also repeats parts of what I quoted from git-config(1) about the default locations of these files in in my previous email): "Which file to place a pattern in depends on how the pattern is meant to be used: - Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore) should go into a .gitignore file. - Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user's workflow) should go into the $GIT_DIR/info/exclude file. - Patterns which a user wants Git to ignore in all situations (e.g., backup or temporary files generated by the user's editor of choice) generally go into a file specified by core.excludesFile in the user's ~/.gitconfig. Its default value is $XDG_CONFIG_HOME/git/ignore. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/ignore is used instead." -- Quoted from gitignore(5) As you can see, $HOME/.gitignore is not part of it. As .gitignore is meant to be checked into repos, I would also advise against setting `core.excludesFile=$HOME/.gitignore'. Instead I would either set it to a distinct filename (e.g., $HOME/.gitexcludes) or stick with the default location ($HOME/.config/git/ignore) for per-user global excludes. Best, Michael
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210406192505.5925243d>