Translate

[git] git: 'remote-http' is not a git command 이슈 해결방법 - Git Sub Command Path 지정 (GIT_EXEC_PATH)

 


증상


[1004lucifer@rhel8 bin]$
# Git 명령어 정상 동작 하지만..
[1004lucifer@rhel8 bin]$ git
usage: git [-v | --version] [-h | --help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
           [--config-env=<name>=<envvar>] <command> [<args>]

These are common Git commands used in various situations:

... (생략)

collaborate (see also: git help workflows)
   fetch     Download objects and refs from another repository
   pull      Fetch from and integrate with another repository or a local branch
   push      Update remote refs along with associated objects

'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
See 'git help git' for an overview of the system.
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
# Git의 Sub Command 동작하지 않음.
[1004lucifer@rhel8 bin]$ git remote-http
git: 'remote-http' is not a git command. See 'git --help'.
[1004lucifer@rhel8 bin]$




원인

- 처음 Git 컴파일 설치 시 설치했던 경로와 현재의 Git 디렉토리 경로가 다른경우
  1. 다른 PC에서 Git 실행파일을 가져와서 설치한경우
  2. 소스 빌드 설치 후 생성된 바이너리 Git 경로가 변경된 경우


1004lucifer


해결방법

Git 설치된 디렉토리 구조에서 libexec/git-core 디렉토리를 찾아서 Git 환경변수를 아래와 같이 셋팅해 준다.


[1004lucifer@rhel8 bin]$
# Git Sub Command 실행경로 셋팅값 확인 
[1004lucifer@rhel8 bin]$ git --exec-path
/home/1004lucifer/git/libexec/git-core
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
# 실제 Git이 설치된 경로와 다름
[1004lucifer@rhel8 bin]$ pwd
/home/1004lucifer/git-binary/bin
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$
[1004lucifer@rhel8 bin]$ cd ../
[1004lucifer@rhel8 git-binary]$ ll
total 0
drwxr-xr-x. 2 1004lucifer 1004lucifer 154 Dec 22 09:17 bin
drwxr-xr-x. 3 1004lucifer 1004lucifer  22 Dec 22 09:17 libexec
drwxr-xr-x. 8 1004lucifer 1004lucifer  90 Dec 22 09:17 share
[1004lucifer@rhel8 git-binary]$
[1004lucifer@rhel8 git-binary]$ cd libexec/
[1004lucifer@rhel8 libexec]$ ll
total 12
drwxr-xr-x. 3 1004lucifer 1004lucifer 8192 Dec 22 09:17 git-core
[1004lucifer@rhel8 libexec]$ cd git-core/
[1004lucifer@rhel8 git-core]$
[1004lucifer@rhel8 git-core]$
[1004lucifer@rhel8 git-core]$ ll
total 3231864
-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git
-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git-add
-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git-am
-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git-annotate

... (생략)

-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git-whatchanged
-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git-worktree
-rwxr-xr-x. 141 1004lucifer 1004lucifer 22905472 Dec 22 09:17 git-write-tree
drwxr-xr-x.   2 1004lucifer 1004lucifer     4096 Dec 22 09:17 mergetools
-rwxr-xr-x.   2 1004lucifer 1004lucifer 14104232 Dec 22 09:17 scalar
[1004lucifer@rhel8 git-core]$
# 실제 Git Sub Command 위치한 경로를 확인
[1004lucifer@rhel8 git-core]$ pwd
/home/1004lucifer/git-binary/libexec/git-core
[1004lucifer@rhel8 git-core]$
[1004lucifer@rhel8 git-core]$
[1004lucifer@rhel8 git-core]$
[1004lucifer@rhel8 git-core]$
# Git의 GIT_EXEC_PATH 환경변수를 설정 (경로는 본인 경로 맞게..)
[1004lucifer@rhel8 git-core]$ vi ~/.bash_profile
export GIT_EXEC_PATH=/home/1004lucifer/git-binary/libexec/git-core

[1004lucifer@rhel8 git-core]$
[1004lucifer@rhel8 git-core]$
# Git Sub Command 정상 동작 확인
[1004lucifer@rhel8 git-core]$ git remote-http
error: remote-curl: usage: git remote-curl <remote> [<url>]
[1004lucifer@rhel8 git-core]$


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


댓글