Is there a way to skip password typing when using https:// on GitHub?

I recently switched to synchronising my repositories to https:// on GitHub (due to firewall issues) and it asks for a password every time. It used to be that I had an SSH certificate, and it was enough. Is there a way to bypass the password in my case (using http/https)?

  • Git repository working with SSH
  • SVN + SASL + ActiveDirectory: How to
  • _netrc/.netrc alternative to cURL
  • Git HTTPS Authentication fails interactively, but works in the URL
  • Password protected jenkins maven repository server - access from maven
  • http 401.1 error while performing a GIT clone from a Linux server
  • Show history of a single file across all branches
  • I just want my development branch to prevail (over master), I don't want to resolve any conflicts
  • Diff a staged file with one in stash
  • Convert Git Repo to Darcs
  • Piping output from Git Bash to clipboard
  • What is a 'dirty' Submodule?
  • 22 Solutions collect form web for “Is there a way to skip password typing when using https:// on GitHub?”

    With Git version 1.7.9 and later

    Since Git 1.7.9 (released in late January 2012), there is a neat mechanism in Git to avoid having to type your password all the time for HTTP / HTTPS, called credential helpers. (Thanks to dazonic for pointing out this new feature in the comments below.)

    With Git 1.7.9 or later, you can just use one of the following credential helpers:

    git config --global credential.helper cache

    … which tells Git to keep your password cached in memory for (by default) 15 minutes. You can set a longer timeout with:

    git config --global credential.helper "cache --timeout=3600"

    (That example was suggested in the GitHub help page for Linux.) You can also store your credentials permanently if so desired, see the other answers below.

    GitHub’s help also suggests that if you’re on Mac OS X and used Homebrew to install Git, you can use the native Mac OS X keystore with:

    git config --global credential.helper osxkeychain

    For Windows, there is a helper called Git Credential Manager for Windows or wincred in msysgit.

    git config --global credential.helper wincred # obsolete

    With Git for Windows 2.7.3+ (March 2016):

    git config --global credential.helper manager

    For Linux, you can use gnome-keyring(or other keyring implementation such as KWallet).

    With Git versions before 1.7.9

    With versions of Git before 1.7.9, this more secure option is not available, and you’ll need to change the URL that your origin remote uses to include the password in this fashion:

    … in other words with :password after the username and before the @.

    You can set a new URL for your origin remote with:

    git config remote.origin.url

    Make sure that you use https and you should be aware that if you do this, your GitHub password will be stored in plaintext in your .git directory, which is obviously undesirable.

    With any Git version (well, since version 0.99)

    An alternative approach is to put your username and password in your ~/.netrc file, although, as with keeping the password in the remote URL, this means that your password will be stored on the disk in plain text and is thus less secure and not recommended. However, if you want to take this approach, add the following line to your ~/.netrc:

    machine <hostname> login <username> password <password>

    … replacing <hostname> with the server’s hostname, and <username> and <password> with your username and password. Also remember to set restrictive file system permissions on that file:

    chmod 600 ~/.netrc

    Note that on Windows, this file should be called _netrc, and you may need to define the %HOME% environment variable – for more details see:

    • Git – How to use .netrc file on windows to save user and password

    You can also have Git store your credentials permanently using the following:

    git config credential.helper store

    Note: While this is convenient, Git will store your credentials in clear text in
    a local file (.git-credentials) under your project directory (see below for the “home” directory). If you don’t like this, delete this file and switch to using the
    cache option.

    If you want Git to resume to asking you for credentials every time it needs to
    connect to the remote repository, you can run this command:

    git config --unset credential.helper

    To store the passwords in .git-credentials in your %HOME% directory as opposed to the project directory: use the --global flag

    git config --global credential.helper store

    TLDR; Use an encrypted netrc file with Git 1.8.3+.

    Saving a password for a Git repository HTTPS URL is possible with a ~/.netrc (Unix) or %HOME%/_netrc (note the _) on Windows.

    But: That file would store your password in plain text.

    Solution: Encrypt that file with GPG (GNU Privacy Guard), and make Git decrypt it each time it needs a password (for push/pull/fetch/clone operation).

    Step-by-Step instructions for Windows

    With Windows:

    (Git has a gpg.exe in its distribution, but using a full GPG installation includes a gpg-agent.exe, which will memorize your passphrase associated to your GPG key.)

    • Install gpg4Win Lite, the minimum gnupg command-line interface (take the most recent gpg4win-vanilla-2.X.Y-betaZZ.exe), and complete your PATH with the GPG installation directory:

      set PATH=%PATH%:C:\path\to\gpg
      copy C:\path\to\gpg\gpg2.exe C:\path\to\gpg\gpg.exe

    (Note the ‘copy‘ command: Git will need a Bash script to execute the command ‘gpg‘. Since gpg4win-vanilla-2 comes with gpg2.exe, you need to duplicate it.)

    • Create or import a GPG key, and trust it:

      gpgp --import aKey
      # or
      gpg --gen-key

    (Make sure to put a passphrase to that key.)

    • Trust that key

    • Install the credential helper script in a directory within your %PATH%:

      cd c:\a\fodler\in\your\path
      curl -o c:\prgs\bin\git-credential-netrc

    (Yes, this is a Bash script, but it will work on Windows since it will be called by Git.)

    • Make a _netrc file in clear text

      login a_login
      password a_password
      protocol https
      login a_login2
      password a_password2
      protocol https

    (Don’t forget the ‘protocol‘ part: ‘http‘ or ‘https‘ depending on the URL you will use.)

    • Encrypt that file:

      gpg -e -r a_recipient _netrc

    (You now can delete the _netrc file, keeping only the _netrc.gpg encrypted one.)

    • Use that encrypted file:

      git config --local credential.helper "netrc -f C:/path/to/_netrc.gpg -v"

    (Note the ‘/‘: C:\path\to... wouldn’t work at all.) (You can use at first -v -d to see what is going on.)

    From now on, any Git command using an HTTP(S) URL which requires authentication will decrypt that _netrc.gpg file and use the login/password associated to the server you are contacting.
    The first time, GPG will ask you for the passphrase of your GPG key, to decrypt the file.
    The other times, the gpg-agent launched automatically by the first GPG call will provide that passphrase for you.

    That way, you can memorize several URLs/logins/passwords in one file, and have it stored on your disk encrypted.
    I find it more convenient than a “cache” helper”, where you need to remember and type (once per session) a different password for each of your remote services, for said password to be cached in memory.

    There’s an easy, old-fashioned way to store user credentials in an HTTPS URL:

    You can change the URL with git remote set-url <remote-repo> <URL>

    The obvious downside to that approach is that you have to store the password in plain text. You can still just enter the user name ( which will at least save you half the hassle.

    You might prefer to switch to SSH or to use the GitHub client software.

    Use a credential store.

    For git 2.11+ on OSX and linux, use git’s built in credential store:

    git config --global credential.helper libsecret

    For msysgit 1.7.9+ on Windows:

    git config --global credential.helper wincred

    For Git 1.7.9+ on OS X use:

    git config --global credential.helper osxkeychain

    I’m probably being a bit slow, but it wasn’t immediately obvious to me that I needed to download the helper first! I found the credential.helper download at Atlassian’s Permanently authenticating with Git repositories, hope it helps.


    Follow these steps if you want to use Git with credential caching on OSX:

    Download the binary git-credential-osxkeychain.

    Run the command below to ensure the binary is executable:

    chmod a+x git-credential-osxkeychain

    Put it in the directory /usr/local/bin.

    Run the command below:

    git config --global credential.helper osxkeychain

    You can just use

    git config credential.helper store

    When you enter password next time with pull or push it will be stored in
    .git-credentials as plain text (a bit unsecure, but just put it to protected folder)

    And that’s it, as stated on this page:

    On a GNU/Linux setup, a ~/.netrc works quite well too:

    $ cat ~/.netrc
    machine login lot105 password howsyafather

    It might depend on which network libraries Git is using for HTTPS transport.

    Simply include the login credentials as part of the URL:

    git remote rm origin 
    git remote add origin

    For Windows you can use Git Credential Manager (GCM) plugin. It is currently maintained by Microsoft. The nice thing is that it saves the password in the Windows Credential Store, not as plain text.

    There is an installer on the releases page of the project. This will also install the official version of git-for-windows with the credential manager built-in. It allows 2-factor authentication for github (and other servers). And has a graphical interface for initially logging in.

    For cygwin users (or users already using the official git-for-windows), you might prefer the manual install. Download the zip package from the releases page. Extract the package then run the install.cmd. This will install to your ~/bin folder. (Be sure your ~/bin directory is in your PATH.) You then configure it using this command:

    git config --global credential.helper manager

    Git will then run the git-credential-manager.exe when authenticating to any server.

    If you don’t want to store your password in plaintext like Mark said, you can use a different github URL for fetching than you do for pushing. In your config file, under [remote "origin"]:

    url = git://
    pushurl =

    It will still ask for a password when you push, but not when you fetch, at least for open source projects.

    You can use credential helpers.

    git config --global credential.helper 'cache --timeout=x'

    where x is the number of seconds.

    An authentication token should be used instead of the account password. Go to GitHub settings/applications and then create a personal access token. The token can be used the same way a password is used.

    The token is intended to allow users not use the account password for project work. Only use the password when doing administration work, like creating new tokens or revoke old tokens.

    Instead of a token or password that grants a user whole access to a GitHub account, a project specific deployment key can be used to grant access to a single project repository. A Git project can be configured to use this different key in the following steps when you still can access other Git accounts or projects with your normal credential:

    1. Write an SSH configuration file that contains the Host, IdentityFile for the deployment key, maybe the UserKnownHostsFile, and maybe the User (though I think you don’t need it).
    2. Write an SSH wrapper shell script that virtually is ssh -F /path/to/your/config $*
    3. Prepend GIT_SSH=/path/to/your/wrapper in front of your normal Git command. Here the git remote (origin) must use the format.


    You can create your own personal API token (OAuth) and use it the same way as you would use your normal credentials (at: /settings/tokens). For example:

    git remote add fork
    git push fork


    Another method is to use configure your user/password in ~/.netrc (_netrc on Windows), e.g.

    login USERNAME
    password PASSWORD

    a credential helper

    To cache your GitHub password in Git when using HTTPS, you can use a credential helper to tell Git to remember your GitHub username and password every time it talks to GitHub.

    • Mac: git config --global credential.helper osxkeychain (osxkeychain helper is required),
    • Windows: git config --global credential.helper wincred
    • Linux and other: git config --global credential.helper cache


    • How to store your GitHub https password on Linux in a terminal keychain?
    • How do I ensure Git doesn’t ask me for my GitHub username and password?
    • Configure Git clients, like GitHub for Windows, to not ask for authentication
    • Pushing a local repo to a GitHub repo which has dual-factor authentication

    Things are a little different if you’re using two-factor authentication as I am. Since I didn’t find a good answer elsewhere, I’ll stick one here so that maybe I can find it later.

    If you’re using two-factor authentication, then specifying username/password won’t even work – you get access denied. But you can use an application access token and use Git’s credential helper to cache that for you. Here are the pertinent links:

    • Setting up the command-line to work with 2-factor auth (search for section titled “How does it work for command-line Git?”)
    • Credential caching

    And I don’t remember where I saw this, but when you’re asked for your username – that’s where you stick the application access token. Then leave the password blank. It worked on my Mac.

    After you clone a repo, you can edit repo/.git/config and add some config like below:

        name = you_name
        password = you_password
        helper = store

    Then you won’t be asked for username and password again.

    It is better to use credentials for security, but you can keep it for some time using cache

    git config --global credential.helper cache
    git config credential.helper 'cache --timeout=3600'

    You credentials will be saved for 3600 seconds.

    I got my answer from gitcredentials(7) Manual Page. For my case, I don’t have credential-cache in my Windows installation; I use credential-store.

    After I use credential-store, the username/password are stored in [user folder]/.git-credentials file. To remove the username/password, just delete the content of the file.

    This works for me I’m using Windows 10

    git config --global credential.helper wincred

    I know this is not a secure solution, but sometimes you need just a simple solution – without installing anything else. And since helper = store did not work for me, I created a dummy helper:

    Create a script an put it in your users bin folder, here named credfake, this script will provide your username and your password:

    while read line
      echo "$line"
    done < "/dev/stdin"
    echo username=mahuser
    echo password=MahSecret12345

    make it executable:

    chmod u+x /home/mahuser/bin/credfake

    then configure it in git:

    git config --global credential.helper /home/mahuser/bin/credfake

    (or use it without –global for the one repo only)

    and – voilá – git will use this user + password.

    The composer documentation mentions that you can prevent it from using the GitHub API, so that it acts like git clone:

    If you set the no-api key to true on a GitHub repository it will clone the repository as it would with any other Git repository instead of using the GitHub API. But unlike using the git driver directly, composer will still attempt to use GitHub’s zip files.

    So the section would look like this:

    "repositories": [
            "type": "vcs",
            "no-api": true,
            "url": ""

    Keep in mind that the API is there for a reason. So it this should be a method of last resort regarding the increased load on

    You also edit the bashrc file and add a script in it.
    This would ask for your password when you start git once and then remembers it until you log-off.

    # start the ssh-agent
    function start_agent {
        echo "Initializing new SSH agent..."
        # spawn ssh-agent
        /usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
        echo succeeded
        chmod 600 "${SSH_ENV}"
        . "${SSH_ENV}" > /dev/null
    if [ -f "${SSH_ENV}" ]; then
         . "${SSH_ENV}" > /dev/null
       ps -ef | grep ${SSH_AGENT_PID} | grep ssh-agent$ > /dev/null || {
    Git Baby is a git and github fan, let's start git clone.