Translate

[Git] system config 파일 접근 오류 (fatal: unable to read config file, hint: Waiting for your editor to close the file... fatal: Invalid path)

 


- system config 를 사용할 시 오류가 발생하는 경우


[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$ git config --system -l
fatal: unable to read config file '/home/1004lucifer/git/etc/gitconfig': No such file or directory
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$ git config --system --edit
hint: Waiting for your editor to close the file... fatal: Invalid path '/home/1004lucifer/git/etc': No such file or directory
[1004lucifer@rhel8 bin]$

# 다음과 같이 작업이 가능하다.

[1004lucifer@rhel8 git]$
# 현재위치 확인 (Git 설치된 디렉토리)
[1004lucifer@rhel8 git]$ pwd
/home/1004lucifer/git
[1004lucifer@rhel8 git]$
[1004lucifer@rhel8 git]$ ls -l
total 0
drwxr-xr-x. 2 1004lucifer 1004lucifer 154 Jan 20 02:06 bin
drwxr-xr-x. 3 1004lucifer 1004lucifer  22 Jan 20 02:06 libexec
drwxr-xr-x. 8 1004lucifer 1004lucifer  90 Jan 20 02:06 share
[1004lucifer@rhel8 git]$
# etc 디렉토리를 생성해 준다.
[1004lucifer@rhel8 git]$ mkdir etc
[1004lucifer@rhel8 git]$
[1004lucifer@rhel8 git]$ ls -l
total 0
drwxr-xr-x. 2 1004lucifer 1004lucifer 154 Jan 20 02:06 bin
drwxrwxr-x. 2 1004lucifer 1004lucifer   6 Jan 20 03:17 etc
drwxr-xr-x. 3 1004lucifer 1004lucifer  22 Jan 20 02:06 libexec
drwxr-xr-x. 8 1004lucifer 1004lucifer  90 Jan 20 02:06 share
[1004lucifer@rhel8 git]$
[1004lucifer@rhel8 git]$ cd etc
[1004lucifer@rhel8 etc]$
# etc 디렉토리안에 gitconfig 파일 생성 (system config 파일)
[1004lucifer@rhel8 etc]$ touch gitconfig
[1004lucifer@rhel8 etc]$
[1004lucifer@rhel8 etc]$ pwd
/home/1004lucifer/git/etc
[1004lucifer@rhel8 etc]$
[1004lucifer@rhel8 etc]$ ls -l
total 0
-rw-rw-r--. 1 1004lucifer 1004lucifer 0 Jan 20 03:17 gitconfig
[1004lucifer@rhel8 etc]$
# system config 파일 환경변수를 추가해 준다. (경로는 본인PC의 경로에 맞게..)
[1004lucifer@rhel8 etc]$ vi ~/.bash_profile
[1004lucifer@rhel8 etc]$
[1004lucifer@rhel8 etc]$
[1004lucifer@rhel8 etc]$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
export PATH=$PATH:/home/1004lucifer/git-binary/bin
export GIT_EXEC_PATH=/home/1004lucifer/git-binary/libexec/git-core
export GIT_CONFIG_SYSTEM=/home/1004lucifer/git/etc/gitconfig
[1004lucifer@rhel8 etc]$
[1004lucifer@rhel8 etc]$
# 추가한 환경변수를 현재 쉘에 바로 적용
[1004lucifer@rhel8 etc]$ source ~/.bash_profile
[1004lucifer@rhel8 etc]$
# 에러 발생하지 않음 확인
[1004lucifer@rhel8 etc]$ git config --system -l
[1004lucifer@rhel8 etc]$


참고
https://1004lucifer.blogspot.com/2023/12/git-how-to-install-git-in-offline.html


댓글