You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to install nbstripout git integrations globally but I get an error finding the file ~/.config/git/attributes.
$ nbstripout --install --global
Traceback (most recent call last):
File "/Users/denniso/opt/anaconda3/bin/nbstripout", line 10, in <module>
sys.exit(main())
File "/Users/denniso/opt/anaconda3/lib/python3.7/site-packages/nbstripout/_nbstripout.py", line 299, in main
sys.exit(install(git_config, user=args._global, attrfile=args.attributes))
File "/Users/denniso/opt/anaconda3/lib/python3.7/site-packages/nbstripout/_nbstripout.py", line 175, in install
with open(attrfile, 'a', newline='') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/denniso/.config/git/attributes'
Is this attribute file expected to exist already? I would expect it to be using the file ~/.gitconfig based on the docs.
I'm not sure if the file ~/.config/git/attributes not existing is a bug with my git setup, or if nbstripout should be modified to create the file if it doesn't exist. I'm happy to make a PR if you have an opinion about how best to handle this.
The ${HOME}/.config/git directory isn't created by default in a Git installation. The error is essentially the same error one would get doing the following:
echo'...'>"${HOME}/.config/git/attributes
nbstripout should create the ${HOME}/.config/git directory (and any missing parent directories) if they don't exist (e.g. mkdir -p "${HOME}/.config/git")
Thanks for reporting this. That is indeed a regression and nbstripout should be creating this directory if needed.
I'm implementing the convention document in man gitattributes btw.:
If you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user’s workflow for that repository), then attributes should be placed in the $GIT_DIR/info/attributes file. Attributes which should be version-controlled and distributed to other repositories (i.e., attributes of interest to all users) should go into .gitattributes files. Attributes that should affect all repositories for a single user should be placed in a file specified by the core.attributesFile configuration option (see git-config(1)). Its default value is $XDG_CONFIG_HOME/git/attributes. If $XDG_CONFIG_HOME is either not set or empty, $HOME/.config/git/attributes is used instead. Attributes for all users on a system should be placed in the $(prefix)/etc/gitattributes file.
I am trying to install nbstripout git integrations globally but I get an error finding the file
~/.config/git/attributes
.Is this attribute file expected to exist already? I would expect it to be using the file
~/.gitconfig
based on the docs.This is on MacOS 10.15.7
The text was updated successfully, but these errors were encountered: