Git and SSH

Stop Git asking for your password

Save your GitHub login for HTTPS remotes, so push and pull stop prompting every time.

  1. Save logins in the macOS Keychain
    Terminal
    git config --global credential.helper osxkeychain

    Next time Git asks, enter your GitHub username and a personal access token (not your password). It's remembered after that.

  2. Create a personal access token
    Terminal
    open https://github.com/settings/tokens/new

Check it worked

  1. Check the setting
    Terminal
    git config --global credential.helper
Undo it
  1. Stop saving logins
    Terminal
    git config --global --unset credential.helper
  1. Remember your login for 8 hours at a time
    Terminal · Ubuntu / Debian
    git config --global credential.helper 'cache --timeout=28800'

    Kept in memory only, never written to disk. Enter your username and a personal access token (not your password).

  2. Create a personal access token
    Terminal · Ubuntu / Debian
    xdg-open https://github.com/settings/tokens/new

Check it worked

  1. Check the setting
    Terminal · Ubuntu / Debian
    git config --global credential.helper
Undo it
  1. Stop saving logins
    Terminal · Ubuntu / Debian
    git config --global --unset credential.helper
  1. Use Git Credential Manager (comes with Git for Windows)
    PowerShell
    git config --global credential.helper manager

    Next time Git asks, a browser window opens to sign in to GitHub. It's remembered after that.

Check it worked

  1. Check the setting
    PowerShell
    git config --global credential.helper
Undo it
  1. Stop saving logins
    PowerShell
    git config --global --unset credential.helper