Open
Description
When there is no ~/.gitconfig
, the following code snippet
import pygit2
global_config = pygit2.Config.get_global_config() # ← Exception raised here
global_config['user.email'] = '[email protected]'
fails with
Traceback (most recent call last):
File "global_config.py", line 2, in <module>
global_config = pygit2.Config.get_global_config()
File "/usr/lib/python3/dist-packages/pygit2/config.py", line 281, in get_global_config
return Config._from_found_config(C.git_config_find_global)
File "/usr/lib/python3/dist-packages/pygit2/config.py", line 265, in _from_found_config
check_error(err, True)
File "/usr/lib/python3/dist-packages/pygit2/errors.py", line 53, in check_error
raise IOError(message)
OSError: the global file '.gitconfig' doesn't exist: No such file or directory
I.e.,
- there seems to be no way of setting a global option unless
~/.gitconfig
already exists. - There seems to be no way to create the global config file ahead of time, at least not in a portable way (I doubt it is in
~/.gitconfig
on Windows systems).
Metadata
Metadata
Assignees
Labels
No labels