{"id":4525,"date":"2025-05-11T14:38:29","date_gmt":"2025-05-11T14:38:29","guid":{"rendered":"https:\/\/geekmungus.co.uk\/?p=4525"},"modified":"2025-05-11T14:38:30","modified_gmt":"2025-05-11T14:38:30","slug":"using-git-with-https","status":"publish","type":"post","link":"https:\/\/geekmungus.co.uk\/?p=4525","title":{"rendered":"Using Git with HTTPS"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Although SSH is preferred, if you want to use Git&#8217;s credential helper here&#8217;s two simple options, note you&#8217;ll probably not want to use the Credentials Helper method, because it stores the credentials in a plain-text file, albeit in your home directory, but still. Using the Credentials Helper, you won\u2019t have to re-enter your username and password each time to commit, push or pull!<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Store Credentials Temporarily in Memory<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Git can cache your credentials in memory for a specified time (e.g., 15 minutes):<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>git config --global credential.helper 'cache --timeout=3600'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This will remember your credentials for one hour (3600 seconds). You can adjust the <code>--timeout<\/code> value as needed. You&#8217;ll still need to enter the credentials once, but you&#8217;ll not have to keep re-entering each time you need to do something with git.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Store Credentials Permanently<\/strong>:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you want Git to remember your credentials permanently, you can use the <strong>Git credential store<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>git config --global credential.helper store<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">After running this command, Git will store your username and password in a plain-text file (<code>~\/.git-credentials<\/code>). The next time you push, Git will automatically use the stored credentials without prompting you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Note<\/strong>: This method stores your credentials in plain text, which is not the most secure approach. You might prefer using a different method or tool like an SSH key.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Although SSH is preferred, if you want to use Git&#8217;s credential helper here&#8217;s two simple options, note you&#8217;ll probably not want to use the Credentials Helper method, because it stores the credentials in a plain-text file, albeit in your home directory, but still. Using the Credentials Helper, you won\u2019t have to re-enter your username and &#8230; <a title=\"Using Git with HTTPS\" class=\"read-more\" href=\"https:\/\/geekmungus.co.uk\/?p=4525\" aria-label=\"Read more about Using Git with HTTPS\">Read more<\/a><\/p>\n","protected":false},"author":4,"featured_media":4205,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42,43],"tags":[],"class_list":["post-4525","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops","category-git"],"_links":{"self":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4525"}],"version-history":[{"count":1,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4525\/revisions"}],"predecessor-version":[{"id":4526,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/4525\/revisions\/4526"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=\/wp\/v2\/media\/4205"}],"wp:attachment":[{"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/geekmungus.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}