{"id":373909,"date":"2021-11-29T15:45:17","date_gmt":"2021-11-29T12:45:17","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-set-up-https-personal-access-tokens-for-github-authentication-cloudsavvy-it\/"},"modified":"2021-11-29T15:45:17","modified_gmt":"2021-11-29T12:45:17","slug":"how-to-set-up-https-personal-access-tokens-for-github-authentication-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-https-personal-access-tokens-for-github-authentication-cloudsavvy-it\/","title":{"rendered":"#How to Set Up HTTPS Personal Access Tokens for Github Authentication \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a29206c28d50\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a29206c28d50\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-https-personal-access-tokens-for-github-authentication-cloudsavvy-it\/#What_Are_Personal_Access_Tokens\" >What Are Personal Access Tokens?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-https-personal-access-tokens-for-github-authentication-cloudsavvy-it\/#Making_a_New_Personal_Access_Token\" >Making a New Personal Access Token<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-https-personal-access-tokens-for-github-authentication-cloudsavvy-it\/#Switching_To_Personal_Access_Tokens\" >Switching To Personal Access Tokens<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Set Up HTTPS Personal Access Tokens for Github Authentication \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage alignnone size-full wp-image-7125\" data-pagespeed-lazy-srcset=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/10\/d6528811.png?width=398&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 400w, https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/10\/d6528811.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1 1200w\" sizes=\"auto, 400w, 1200w\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/10\/d6528811.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"700\" height=\"300\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>As of August 2021, <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.blog\/2020-12-15-token-authentication-requirements-for-git-operations\/\">Github has removed support<\/a> for using your account password from the Git command line. You can still use HTTPS, but you will need to set up a Personal Access Token to use instead of your password.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"What_Are_Personal_Access_Tokens\"><\/span>What Are Personal Access Tokens?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Github still chooses to recommend easier-to-use HTTPS endpoints for accessing repos, but their password based security is a major downside. This is why, if you\u2019ve tried to push or pull code using your account password recently, you may have received the following error:<\/p>\n<pre>remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.<\/pre>\n<p>Git\u2019s command line is a bit misleading here, because it does ask for your \u201cpassword,\u201d but Git wants you to use something called a <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/docs.github.com\/en\/authentication\/keeping-your-account-and-data-secure\/creating-a-personal-access-token\">Personal Access Token (PAT)<\/a>. This works a lot like a secondary password, except it\u2019s unique, more secure, and can be given more specific permissions that let you grant access to your account safely.<\/p>\n<p>You use PATs exactly like passwords\u2014instead of typing in your account password for <code>git<\/code>, you\u2019ll enter the PAT. You can also choose to cache the token forever, so you don\u2019t have to enter it in all the time. This token can also be used to access the Github API, but that isn\u2019t necessary for most people\u2019s usage.<\/p>\n<p>You can also switch to SSH based authentication, which works pretty similarly to access tokens, except they\u2019re tied to your machine and not transmitted anywhere. Still, PATs are easy to set up and use, and do have more flexible permissions than SSH keys.<\/p>\n<p><strong>RELATED:<\/strong> <strong><em>How To Switch a Github Repository to SSH Authentication<\/em><\/strong><\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Making_a_New_Personal_Access_Token\"><\/span>Making a New Personal Access Token<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Setting up a PAT will require you to make a new one from Github\u2019s settings, and swap your local repositories over to using them.\u00a0Head over to your <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/settings\/tokens\">personal account settings to generate a new token<\/a>. Scroll down to \u201cDeveloper Settings.\u201d Select \u201cPersonal Access Tokens,\u201d and generate a new one:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14873\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/11\/23277ef6.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1334\" height=\"419\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You\u2019ll need to verify your actual account password. Give the token a name, and select an expiration date. You probably want to change it from the default of 30 days, though Github will show a warning if you select \u201cNo Expiration.\u201d It\u2019s not terrible to have a permanent token, but you should likely be changing passwords and tokens at least every 6 months.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14874\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/11\/f9f09ee5.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"1258\" height=\"381\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Finally, you can choose which scopes this token has. This allows you to allow or disallow certain actions. If you just want to use <code>git<\/code>\u00a0from the command line with your repositories, you probably only care about the \u201crepo\u201d scope, which gives control over your repositories.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14875\" data-pagespeed-lazy-src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2021\/11\/c1c13ab4.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"975\" height=\"576\" src=\"\/pagespeed_static\/1.JiBnMqyl6S.gif\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>You\u2019ll get a token like the following, that can be used in place of your password:<\/p>\n<pre>ghp_cgq4ZrHmFu0lLPl7ajKAwgMPnT5zhF00000<\/pre>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Switching_To_Personal_Access_Tokens\"><\/span>Switching To Personal Access Tokens<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>If your account password isn\u2019t cached, you can simply enter in the new token, and it should work. If your cache is stale though, you will need to reset it.<\/p>\n<p>On Windows, if you\u2019re using native Git (not through WSL), you will need to open up \u201c<strong>Manage Windows Credentials<\/strong>\u201d from Control Panel or the Start Menu, and edit or add the password to <code>git:https:\/\/github.com<\/code>.<\/p>\n<p>On macOS, it\u2019s accessible through the <strong>Keychain Access<\/strong> <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>. Search for \u201cgithub.com,\u201d find the \u201cinternet password\u201d entry for your Git account, and change the key.<\/p>\n<p>For Linux or WSL, you\u2019ll need to unset the cache, either locally (for a single repo), or globally:<\/p>\n<pre>git config --local --unset credential.helper&#13;\ngit config --global --unset credential.helper<\/pre>\n<p>Then, you can push or pull from your repo normally, and it will have you enter the new PAT if it\u2019s not yet cached. You can cache this token for longer, either by editing the cache timeout in the credential helper:<\/p>\n<pre>git config --global credential.helper \"cache --timeout=86400\"<\/pre>\n<p>Or by configuring it to store the credentials permanently in <code>~\/.github-credentials<\/code>:<\/p>\n<pre>git config credential.helper store<\/pre>\n<p>Note that if you previously had this cache turned on, you may need to delete the line with the old cached credentials in the <code>~\/.github-credentials<\/code>\u00a0file.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/14870\/how-to-set-up-https-personal-access-tokens-for-github-authentication\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Set Up HTTPS Personal Access Tokens for Github Authentication \u2013 CloudSavvy IT&#8221; As of August 2021, Github has removed support for using your account password from the Git command line. You can still use HTTPS, but you will need to set up a Personal Access Token to use instead of your password. What&#8230;<\/p>\n","protected":false},"author":1,"featured_media":373912,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/10\/d6528811.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-373909","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/373909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=373909"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/373909\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/373912"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=373909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=373909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=373909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}