Frecuentemente publicamos actualizaciones de nuestra documentación. Es posible que la traducción de esta página esté en curso. Para conocer la información más actual, visita la documentación en inglés. Si existe un problema con las traducciones en esta página, por favor infórmanos.
GitHub AE is currently under limited release. Please contact our Sales Team to find out more.

Caching your GitHub credentials in Git

If you're cloning GitHub Enterprise repositories using HTTPS, you can use a credential helper to tell Git to remember your credentials.

If you clone GitHub Enterprise repositories using SSH, then you authenticate using an SSH key instead of using other credentials. For information about setting up an SSH connection, see "Generating an SSH Key."


  • You need Git 1.7.10 or newer to use the osxkeychain credential helper.
  • If you installed Git using Homebrew, the osxkeychain helper will already be installed.
  • If you're running Mac OS X 10.7 and above and you installed Git through Apple's Xcode Command Line Tools, then osxkeychain helper is automatically included in your Git installation.

Install Git and the osxkeychain helper and tell Git to use it.

  1. Find out if Git and the osxkeychain helper are already installed:

    $ git credential-osxkeychain
    # Test for the cred helper
    > Usage: git credential-osxkeychain <get|store|erase>
  2. If the osxkeychain helper isn't installed and you're running OS X version 10.9 or above, your computer will prompt you to download it as a part of the Xcode Command Line Tools:

    $ git credential-osxkeychain
     > xcode-select: note: no developer tools were found at '/Applications/',
     > requesting install. Choose an option in the dialog to download the command line developer tools.

    Alternatively, you can install Git and the osxkeychain helper by using Homebrew:

    $ brew install git
  3. Tell Git to use osxkeychain helper using the global credential.helper config:

    $ git config --global credential.helper osxkeychain
    # Set git to use the osxkeychain credential helper

The next time you clone an HTTPS URL that requires authentication, Git will prompt you for your username and password. La autenticación basada en contraseña para Git es ahora obsoleta y te recomendamos utilizar un token de acceso personal (PAT) en sustitución cuando se te pida la contraseña, lo cual es más seguro. Trata a tu token tal como lo harías con una contraseña. Para obtener más información, consulta la sección "Crear un token de acceso personal".

Once you've authenticated successfully, your credentials are stored in the macOS keychain and will be used every time you clone an HTTPS URL. You won't be required to type your credentials in to Git again unless you change your credentials.

Tip: You need Git 1.7.10 or newer to use the credential helper.

You can also install a native Git shell, such as Git for Windows. With Git for Windows, running the following in the command line will store your credentials:

$ git config --global credential.helper wincred

Tip: You need Git 1.7.10 or newer to use the credential helper.

Turn on the credential helper so that Git will save your password in memory for some time. By default, Git will cache your password for 15 minutes.

  1. In Terminal, enter the following:
    $ git config --global credential.helper cache
    # Set git to use the credential memory cache
  2. To change the default password cache timeout, enter the following:
    $ git config --global credential.helper 'cache --timeout=3600'
    # Set the cache to timeout after 1 hour (setting is in seconds)

Further reading

¿Te ayudó este documento?

Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

O, learn how to contribute.