If you're cloning GitHub repositories using HTTPS, you can use a credential helper to tell Git to remember your GitHub username and password every time it talks to GitHub.
If you clone GitHub repositories using SSH, then you authenticate using SSH keys instead of a username and password. For help setting up an SSH connection, see Generating SSH Keys.
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.
-
In Terminal, enter the following:
git config --global credential.helper cache # Set git to use the credential memory cache
-
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)
Revisions
- February 27, 2015 @ 11:14:36 [Current Revision] by admin
- February 27, 2015 @ 11:14:36 by admin
- February 27, 2015 @ 11:14:20 by admin
- February 27, 2015 @ 11:13:39 by admin
- February 27, 2015 @ 11:13:07 by admin
Revision Differences
February 27, 2015 @ 11:13:07 | Current Revision | ||
---|---|---|---|
Title | |||
Deleted: Caching your GitHub password in Git | Added: Caching your GitHub, Gitlab password in Git |
Content | |||
---|---|---|---|
Unchanged: <h2 style="margin: 10px 0px; padding: 0px; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 30px; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <h2 style="margin: 10px 0px; padding: 0px; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 30px; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: | Unchanged: | ||
Unchanged: </h2> | Unchanged: </h2> | ||
Deleted: <div id="article-platform-nav" style="margin: 0px; padding: 0px; border: 0px; font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 15px; font-stretch: inherit; line-height: 23.3333339691162px; vertical-align: baseline;"> | |||
Deleted: <p class="platform-mac" style="margin: 0px; padding: 0px 0px 5px; border: 0px; font-family: inherit; font-size: 10px; font-style: inherit; font-variant: inherit; font-weight: bold; font-stretch: inherit; line-height: inherit; vertical-align: baseline; display: block; float: left; text-transform: uppercase;"> | |||
Deleted: <a data-platform="mac" href="https:/ /help.github.com/articles/ caching-your- github-password- in-git/#platform-mac" style="margin: 0px; padding: 0px 5px; border: none; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">MAC</a> | |||
Deleted: </p> | |||
Deleted: <ul style="margin: 0px 0px 0px -5px; padding-right: 0px; padding-left: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; list-style: none; overflow: hidden;"> | |||
Deleted: <li class="platform-windows" style="margin: 0px; padding: 0px 0px 5px; border: 0px; font-family: inherit; font-size: 10px; font-style: inherit; font-variant: inherit; font-weight: bold; font-stretch: inherit; line-height: inherit; vertical-align: baseline; display: block; float: left; text-transform: uppercase;"> | |||
Deleted: <a data-platform="windows" href="https:/ /help.github.com/articles/ caching-your- github-password- in-git/#platform-windows" style="margin: 0px; padding: 0px 5px; border-width: 0px 0px 0px 1px; border-left-style: solid; border-left-color: rgb(153, 153, 153); font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">WINDOWS</a> | |||
Deleted: </li> | |||
Deleted: <li class="platform-linux selected" style="margin: 0px; padding: 0px 0px 5px; border: 0px; font-family: inherit; font-size: 10px; font-style: inherit; font-variant: inherit; font-weight: bold; font-stretch: inherit; line-height: inherit; vertical-align: baseline; display: block; float: left; text-transform: uppercase; color: rgb(102, 102, 102); cursor: default; background: url(https://help.github.com/ assets/images/site/under- triangle.gif) 50% 100% no-repeat transparent;"> | |||
Deleted: <a data-platform="linux" href="https:/ /help.github.com/articles/ caching-your- github-password- in-git/#platform-linux" style="margin: 0px; padding: 0px 5px; border-width: 0px 0px 0px 1px; border-left-style: solid; border-left-color: rgb(153, 153, 153); font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(51, 51, 51); text-decoration: none;">LINUX</a> | |||
Deleted: </li> | |||
Deleted: <li class="platform-all" style="margin: 0px; padding: 0px 0px 5px; border: 0px; font-family: inherit; font-size: 10px; font-style: inherit; font-variant: inherit; font-weight: bold; font-stretch: inherit; line-height: inherit; vertical-align: baseline; display: block; float: left; text-transform: uppercase;"> | |||
Deleted: <a data-platform="all" href="https:/ /help.github.com/articles/ caching-your- github-password- in-git/#platform-all" style="margin: 0px; padding: 0px 5px; border-width: 0px 0px 0px 1px; border-left-style: solid; border-left-color: rgb(153, 153, 153); font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">ALL</a> | |||
Deleted: </li> | |||
Deleted: </ul> | |||
Deleted: </div> | |||
Deleted: | Added: | ||
Unchanged: <div class="intro" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(102, 102, 102);"> | Unchanged: <div class="intro" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(102, 102, 102);"> | ||
Unchanged: <p style="margin: 1em 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <p style="margin: 1em 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: If you're <a href="https:/ /help.github.com/articles/ which-remote- url-should-i-use" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">cloning GitHub repositories using HTTPS</a>, you can use a <em style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">credential helper</em> to tell Git to remember your GitHub username and password every time it talks to GitHub. | Unchanged: If you're <a href="https:/ /help.github.com/articles/ which-remote- url-should-i-use" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">cloning GitHub repositories using HTTPS</a>, you can use a <em style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">credential helper</em> to tell Git to remember your GitHub username and password every time it talks to GitHub. | ||
Unchanged: </p> | Unchanged: </p> | ||
Unchanged: </div> | Unchanged: </div> | ||
Unchanged: <p style="margin: 1em 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <p style="margin: 1em 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: If you clone GitHub repositories using SSH, then you authenticate using SSH keys instead of a username and password. For help setting up an SSH connection, see <a href="https:/ /help.github.com/articles/ generating-ssh-keys" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">Generating SSH Keys</a>. | Unchanged: If you clone GitHub repositories using SSH, then you authenticate using SSH keys instead of a username and password. For help setting up an SSH connection, see <a href="https:/ /help.github.com/articles/ generating-ssh-keys" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(65, 131, 196); text-decoration: none;">Generating SSH Keys</a>. | ||
Unchanged: </p> | Unchanged: </p> | ||
Unchanged: <div class="platform-linux" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; display: inline;"> | Unchanged: <div class="platform-linux" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; display: inline;"> | ||
Unchanged: <div class="alert tip" style="margin: 0px auto; padding: 15px; border: 1px solid rgb(151, 193, 218); font-family: inherit; font-size: 12px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; position: relative; color: rgb(38, 76, 114); border-radius: 3px; box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 3px; text-shadow: rgba(255, 255, 255, 0.8) 0px 1px 0px; background: -webkit-linear- gradient(top, rgb(216, 235, 248), rgb(208, 227, 239));"> | Unchanged: <div class="alert tip" style="margin: 0px auto; padding: 15px; border: 1px solid rgb(151, 193, 218); font-family: inherit; font-size: 12px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; position: relative; color: rgb(38, 76, 114); border-radius: 3px; box-shadow: rgba(0, 0, 0, 0.0980392) 0px 1px 3px; text-shadow: rgba(255, 255, 255, 0.8) 0px 1px 0px; background: -webkit-linear- gradient(top, rgb(216, 235, 248), rgb(208, 227, 239));"> | ||
Unchanged: <p style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <p style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: <strong style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">Tip: </strong> You need Git <strong style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">1.7.10< /strong> or newer to use the credential helper. | Unchanged: <strong style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">Tip: </strong> You need Git <strong style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">1.7.10< /strong> or newer to use the credential helper. | ||
Added: </p> | |||
Added: <p> | |||
Added: | |||
Added: </p> | |||
Added: <p> | |||
Added: | |||
Added: </p> | |||
Added: <p> | |||
Added: | |||
Unchanged: </p> | Unchanged: </p> | ||
Unchanged: </div> | Unchanged: </div> | ||
Unchanged: <p style="margin: 1em 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <p style="margin: 1em 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: 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. | Unchanged: 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. | ||
Unchanged: </p> | Unchanged: </p> | ||
Unchanged: <ol style="margin: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; list-style: none; counter-reset: li 0; position: relative;"> | Unchanged: <ol style="margin: 0px; padding-right: 0px; padding-bottom: 10px; padding-left: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; list-style: none; counter-reset: li 0; position: relative;"> | ||
Unchanged: <li style="margin: 0px 0px 5px; padding: 5px 0px 5px 55px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; position: relative;"> | Unchanged: <li style="margin: 0px 0px 5px; padding: 5px 0px 5px 55px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; position: relative;"> | ||
Unchanged: <p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: In Terminal, enter the following: | Unchanged: In Terminal, enter the following: | ||
Unchanged: </p> | Unchanged: </p> | ||
Unchanged: <pre class="command-line" style="margin-top: 10px; margin-bottom: 10px; padding: 10px; border: 2px solid rgb(221, 221, 221); font-family: Monaco, 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 13px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; border-radius: 3px; -webkit-background-clip: padding-box; color: rgb(255, 255, 255); -webkit-font-smoothing: auto; overflow: auto; background-color: rgb(51, 51, 51); background-clip: padding-box;"> | Unchanged: <pre class="command-line" style="margin-top: 10px; margin-bottom: 10px; padding: 10px; border: 2px solid rgb(221, 221, 221); font-family: Monaco, 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 13px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; border-radius: 3px; -webkit-background-clip: padding-box; color: rgb(255, 255, 255); -webkit-font-smoothing: auto; overflow: auto; background-color: rgb(51, 51, 51); background-clip: padding-box;"> | ||
Unchanged: <span class="command" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">git config --global credential.helper cache</span> | Unchanged: <span class="command" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">git config --global credential.helper cache</span> | ||
Unchanged: <span class="comment" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(204, 204, 204);"># Set git to use the credential memory cache</span> | Unchanged: <span class="comment" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(204, 204, 204);"># Set git to use the credential memory cache</span> | ||
Unchanged: </pre> | Unchanged: </pre> | ||
Unchanged: </li> | Unchanged: </li> | ||
Unchanged: <li style="margin: 0px 0px 5px; padding: 5px 0px 5px 55px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; position: relative;"> | Unchanged: <li style="margin: 0px 0px 5px; padding: 5px 0px 5px 55px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; position: relative;"> | ||
Unchanged: <p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | Unchanged: <p style="margin: 0px 0px 1em; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;"> | ||
Unchanged: To change the default password cache timeout, enter the following: | Unchanged: To change the default password cache timeout, enter the following: | ||
Unchanged: </p> | Unchanged: </p> | ||
Unchanged: <pre class="command-line" style="margin-top: 10px; margin-bottom: 10px; padding: 10px; border: 2px solid rgb(221, 221, 221); font-family: Monaco, 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 13px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; border-radius: 3px; -webkit-background-clip: padding-box; color: rgb(255, 255, 255); -webkit-font-smoothing: auto; overflow: auto; background-color: rgb(51, 51, 51); background-clip: padding-box;"> | Unchanged: <pre class="command-line" style="margin-top: 10px; margin-bottom: 10px; padding: 10px; border: 2px solid rgb(221, 221, 221); font-family: Monaco, 'DejaVu Sans Mono', 'Courier New', monospace; font-size: 13px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; border-radius: 3px; -webkit-background-clip: padding-box; color: rgb(255, 255, 255); -webkit-font-smoothing: auto; overflow: auto; background-color: rgb(51, 51, 51); background-clip: padding-box;"> | ||
Unchanged: <span class="command" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">git config --global credential.helper 'cache --timeout=3600'</span> | Unchanged: <span class="command" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline;">git config --global credential.helper 'cache --timeout=3600'</span> | ||
Unchanged: <span class="comment" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(204, 204, 204);"># Set the cache to timeout after 1 hour (setting is in seconds)</span></pre> | Unchanged: <span class="comment" style="margin: 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; vertical-align: baseline; color: rgb(204, 204, 204);"># Set the cache to timeout after 1 hour (setting is in seconds)</span></pre> | ||
Unchanged: </li> | Unchanged: </li> | ||
Unchanged: </ol> | Unchanged: </ol> | ||
Unchanged: </div> | Unchanged: </div> | ||
Unchanged: </div> | Unchanged: </div> |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.