How to use git with gnome

Git 1.8.0 supports integration with gnome-keyring.

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

After reading the docs about the git credentials helpers: http://git-scm.com/docs/gitcredentials.html

I was not able to find a way to use this new feature. How can I integrate it? I'm using Archlinux with git installed from Archlinux's repository. (git 1.8.0)


@ marcosdsanchez的答案是Arch(它回答了原来的问题),但是我在Ubuntu 13.04上,所以这就是我必须做的:

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 comes with gnome-keyring support but the binary needs to be compiled for your platform.

This is what solved it for me in 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 solution was close, but the git config command should point to the executable. That's why it was not working for me.


Update Q4 2016:

  • Unix, Mac (Git 2.11+)

    git config --global credential.helper libsecret
    
  • (See "Error when using Git credential helper with gnome-keyring ")

  • Windows:

    git config --global credential.helper manager
    
  • (See "How to sign out in Git Bash console in Windows?": That is Git for Windows using the latest Microsoft Git Credential Manager for Windows )


    Original answer (2012)

    Credential Helpers, for Windows, Mac and Unix platforms, have been introduced first in "git-credential-helper" repo, which now has been included in git distro :

    This repository contains the set of Git credential helpers ( gitcredentials (7)) that are part of git (or meant to be contributed in the future).

    $ 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
    

    when build, it would be install in /path/to/git/credential directory.

    To use this backend, you can add it to your (global) Git configuration by setting

    (here for Unix):

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

    Note for Windows:

    I suppose you could make a program running on Windows and calling a library like "pypi keyring 0.10.
    But that is the back-end, and you don't use it directly from Git.

    What you are using is a "credential helper" (which, in turn, will call any credential API it wants on Windows).

    GitHub for Windows provides such an helper (as an executable called... github), and can store your credentials for the duration of the Windows session.
    Launch a shell from that "GitHub for Windows" windows, and you will see, typing "git config --system -l":

    C:UsersVonCDocumentsGitHubtest [master +2 ~0 -0 !]> git config --system -l
    credential.helper=!github --credentials
    

    The credential.helper=!github --credentials part will call the credential helper ' github '.

    $ git config [--global] credential.helper $BACKEND
    
    链接地址: http://www.djcxy.com/p/22060.html

    上一篇: 如何在Windows上使用.netrc文件来保存用户和密码

    下一篇: 如何在gnome中使用git