programing

git와 gnome-keyring 통합 사용 방법

mailnote 2023. 8. 9. 20:57
반응형

git와 gnome-keyring 통합 사용 방법

Git 1.8.0은 gnome 키링과의 통합을 지원합니다.

http://www.h-online.com/open/news/item/Git-1-8-0-can-access-Windows-and-GNOME-keyrings-1733879.html

Git 자격 증명 도우미에 대한 문서를 읽은 후: http://git-scm.com/docs/gitcredentials.html

저는 이 새로운 기능을 사용할 방법을 찾지 못했습니다.어떻게 통합할 수 있습니까?나는 Archlinux의 저장소에서 git가 설치된 Archlinux를 사용하고 있습니다.(git 1.8.0)

@마르코산체스의 대답은 아치(원래 질문에 답함)를 위한 것이지만 저는 우분투에 있습니다.git >= 2.11의 경우:

sudo apt-get install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret

Git < 2.11:

sudo apt-get install libgnome-keyring-dev
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

Git 1.8.0은 gnome-keyring 지원과 함께 제공되지만 플랫폼을 위해 바이너리를 컴파일해야 합니다.

Archlinux에서 이 문제를 해결한 것은 다음과 같습니다.

$ sudo pacman -S libgnome-keyring
$ cd /usr/share/git/credential/gnome-keyring
$ make
$ git config --global credential.helper /usr/share/git/credential/gnome-keyring/git-credential-gnome-keyring

@VonC 솔루션이 가까웠지만 git config 명령이 실행 파일을 가리켜야 합니다.그래서 그게 제게 효과가 없었던 겁니다.

2016년 4분기 업데이트:

  • Unix, Mac(Git 2.11+)

      git config --global credential.helper libsecret
    

("Git 자격 증명 도우미를 "와 함께 사용할 때 오류" 참조)

  • Windows:

      git config --global credential.helper manager
    

Windows에서 Git Bash 콘솔에서 로그아웃하는 방법을 참조하십시오.최신 Microsoft Git Credential Manager for Windows를 사용하는 Git(Windows용 Git)입니다.

주사항:libgnome-keyringGNOME에 고유하며 다음과 같습니다.


원답 (2012)

Windows, Mac 및 Unix 플랫폼용 자격 증명 도우미는 "git-credential-helper" repo에 처음 도입되었으며 현재 gitdistro에 포함되어 있습니다.

증명 Git gitcredentials은 것의일부의 입니다.git(또는 미래에 기여할 예정임).

$ git clone git://github.com/pah/git-credential-helper.git
$ BACKEND=gnome-keyring      # or any other backend
$ cd git-credential-helper/$BACKEND
$ make
$ cp git-credential-$BACKEND /path/to/git/crendential

다▁installed▁be니▁when▁would에 설치될 것입니다./path/to/git/credential디렉토리입니다.

이 백엔드를 사용하려면 다음을 설정하여 이 백엔드를 (글로벌) Git 구성에 추가할 수 있습니다.

(Unix의 경우 여기):

git config --global credential.helper /path/to/git/credential/gnome-keyring/git-credential-gnome-keyring

Windows에 대한 참고:

나는 당신이 윈도우에서 실행되고 "pypi keyring 0.10"과 같은 라이브러리를 호출하는 프로그램을 만들 수 있다고 생각합니다.
하지만 그것은 백엔드이며, Git에서 직접 사용하지는 않습니다.

사용 중인 것은 "자격 증명 도우미"(Windows에서 원하는 모든 자격 증명 API를 호출)입니다.

GitHub for Windows는 이러한 도우미를 제공합니다(예: ...라는 실행 파일).github 및 할 수 있습니다. 및 윈도우즈 세션 동안 자격 증명을 저장할 수 있습니다.
Windows하면 "GitHub for Windows"를하는 것을 볼 수 .git config --system -l":

C:\Users\VonC\Documents\GitHub\test [master +2 ~0 -0 !]> git config --system -l
credential.helper=!github --credentials

credential.helper=!github --credentials 증명를 '자격 증명 도우미'라고 부릅니다.github'.

$ git config [--global] credential.helper $BACKEND

2018년 10월 업데이트

GNOME에서 libgnome 키링을 사용하지 않고 libsecret으로 대체했습니다.Commit https://github.com/git/git/commit/87d1353a6a 에서 새 자격 증명 도우미 /usr/libexec/git-core/git-incential-libsecret을 추가했습니다.

git config --global credential.helper libsecret

페도라에 있는 모든 사람들을 위해 제임스 워드의 답변을 약간 편집했습니다.

sudo yum install libgnome-keyring-devel
cd /usr/share/doc/git/contrib/credential/gnome-keyring
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/gnome-keyring/git-credential-gnome-keyring

두을 이두줄당것추요가세하에신의을▁your▁to▁these요▁just▁add세▁two에 추가하면 됩니다.~/.gitconfig파일 이름:

[credential]
    helper = gnome-keyring

Git로부터 Keyring에 은 Git의 "Gnome Keyring." (Gnome의 "Gnome Keyring"에서 확인할 수 .seahorse도구)를 클릭하면 암호를 다시 입력하라는 메시지가 표시되지 않습니다.

이것은 Git 버전이 2.1.0과 같이 충분히 새로운 버전이고 다음 버전이라고 가정합니다. 리눅스 Fedora, RHEL 또는 CentOS.이전 버전 또는 다른 OS/디스트리뷰터의 경우 다른 답변을 확인하십시오.

Fedora에 설치해야 합니다.

$ sudo dnf install git-credential-libsecret

자격 증명 도우미를 사용하도록 Git 구성을 편집합니다.

[credential]
    helper = /usr/libexec/git-core/git-credential-libsecret

로 참고로참고.libsecret패키지가 최근에 분할되었습니다. @rugk의 게시물을 참조하십시오.따라서 사용자가 이 패키지를 다시 설치해야 합니다.

일부 배포판은 컴파일을 필요로 하지 않고 설치 패키지로 이 통합 기능이 제공합니다. GNOME을 .gnome-keyring또는libsecret, 를 들어 키지의버, 비한것전과 같은 git-credential-gnome-keyring(SUSE Leap 42.3 참조).

그러나 이 자체로는 Git를 GNOME 키링과 자동으로 통합할 수 없습니다.계속해서 다음 자격 증명 저장소 방법을 사용하도록 Git를 구성해야 합니다.

git config --global credential.helper gnome-keyring # If you installed git-credential-gnome-keyring
git config --global credential.helper libsecret     # If you installed git-credential-libsecret

헤드리스 서버에서 Ubuntu에 대한 답변을 시도하던 중 토큰을 입력할 때 다음 오류가 발생했습니다.

Remote error from secret service: org.freedesktop.DBus.Error.UnknownMethod: No such interface 'org.freedesktop.Secret.Collection' on object at path /org/freedesktop/secrets/collection/login

store failed: No such interface 'org.freedesktop.Secret.Collection' on object at path /org/freedesktop/secrets/collection/login

다음은 헤드리스 서버에서 작동한 솔루션입니다(https://keyring.readthedocs.io/en/latest/ # using-keyring-on-headless-linux-systems 참조).

  • 먼저 설정할 응답과 동일한 명령을 실행했습니다.git-credential-libsecret▁the로서credential.helper:
# You may also first install gnome-keyring if not installed
sudo apt install gnome-keyring
sudo apt install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret
  • 그런 다음 자격 증명을 사용할 세션을 시작할 때마다 다음과 같은 명령을 사용합니다.git push:), 실행:
dbus-run-session -- sh  # Replace 'sh' with whatever shell you use.
gnome-keyring-daemon --unlock
# Enter your token here, then hit Enter, then Ctrl+d
# You might clean the terminal display with Ctrl+l for security reasons

를 들어 세션을 실행할 수 D-D-Bus 합니다.git push자동 인증 기능이 있는 등의 기능을 제공합니다.

Arch Linux의 git 패키지에는 git-credential-libsecret(git-credential-gnome-keyring을 대체함)이 포함되어 있으므로 다음을 실행할 수 있습니다.

git config --global credential.helper libsecret

암호나 개인 토큰을 입력하는 대신 git-credential-oauth를 사용할 수도 있습니다.

암호가 더 이상 없습니다!개인 액세스 토큰이 더 이상 없습니다!SSH 키가 더 이상 없습니다!

OAuth를 사용하여 GitHub, GitLab, BitBucket 및 기타 forges에 대해 안전하게 인증하는 Git 자격 증명 도우미입니다.

처음 누르면 도우미가 브라우저 창을 열어 인증합니다.스토리지 수명 내의 후속 푸시는 상호 작용이 필요하지 않습니다.

이것은 git-credential-cache 또는 git-credential-libsecret를 포함한 모든 스토리지 도우미와 호환됩니다.

언급URL : https://stackoverflow.com/questions/13385690/how-to-use-git-with-gnome-keyring-integration

반응형