import{_ as o}from"./chunks/PageInfo.vue_vue_type_script_setup_true_lang.250b3e56.js";import{_ as n,o as e,c as l,H as t,k as s,a as p,Q as r}from"./chunks/framework.b7580407.js";import"./chunks/commonjsHelpers.725317a4.js";const E=JSON.parse('{"title":"Git push results in \\"Authentication Failed”","description":"","frontmatter":{"title":"Git push results in \\"Authentication Failed”","editLink":true,"lastUpdated":true},"headers":[],"relativePath":"getting-started.md","filePath":"getting-started.md","lastUpdated":1710267506000}'),i={name:"getting-started.md"},c=s("h1",{id:"git-push-results-in-authentication-failed",tabindex:"-1"},[p('Git push results in "Authentication Failed” '),s("a",{class:"header-anchor",href:"#git-push-results-in-authentication-failed","aria-label":'Permalink to "Git push results in "Authentication Failed”"'},"​")],-1),y=r(`<h2 id="issue" tabindex="-1">Issue <a class="header-anchor" href="#issue" aria-label="Permalink to &quot;Issue&quot;">​</a></h2><div class="language-bash vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki github-dark-dimmed vp-code-dark"><code><span class="line"><span style="color:#F69D50;">$</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">git</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">push</span></span>
<span class="line"><span style="color:#F69D50;">Username</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">for</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&#39;https://github.com&#39;:</span><span style="color:#ADBAC7;"> \${{ GITHUB_USERNAME }</span><span style="color:#96D0FF;">}</span></span>
<span class="line"><span style="color:#F69D50;">Password</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">for</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&#39;https://andatoshiki@github.com&#39;:</span><span style="color:#ADBAC7;"> \${{ GITHUB_PASSWORD }</span><span style="color:#96D0FF;">}</span><span style="color:#ADBAC7;"> </span><span style="color:#768390;"># or GitHub personal access token</span></span>
<span class="line"><span style="color:#F69D50;">remote:</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">Invalid</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">username</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">or</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">password.</span></span>
<span class="line"><span style="color:#F69D50;">fatal:</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">Authentication</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">failed</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">for</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">&#39;https://github.com/andatoshiki/andatoshiki.git/&#39;</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6F42C1;">$</span><span style="color:#24292E;"> </span><span style="color:#032F62;">git</span><span style="color:#24292E;"> </span><span style="color:#032F62;">push</span></span>
<span class="line"><span style="color:#6F42C1;">Username</span><span style="color:#24292E;"> </span><span style="color:#032F62;">for</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;https://github.com&#39;:</span><span style="color:#24292E;"> \${{ GITHUB_USERNAME }</span><span style="color:#032F62;">}</span></span>
<span class="line"><span style="color:#6F42C1;">Password</span><span style="color:#24292E;"> </span><span style="color:#032F62;">for</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;https://andatoshiki@github.com&#39;:</span><span style="color:#24292E;"> \${{ GITHUB_PASSWORD }</span><span style="color:#032F62;">}</span><span style="color:#24292E;"> </span><span style="color:#6A737D;"># or GitHub personal access token</span></span>
<span class="line"><span style="color:#6F42C1;">remote:</span><span style="color:#24292E;"> </span><span style="color:#032F62;">Invalid</span><span style="color:#24292E;"> </span><span style="color:#032F62;">username</span><span style="color:#24292E;"> </span><span style="color:#032F62;">or</span><span style="color:#24292E;"> </span><span style="color:#032F62;">password.</span></span>
<span class="line"><span style="color:#6F42C1;">fatal:</span><span style="color:#24292E;"> </span><span style="color:#032F62;">Authentication</span><span style="color:#24292E;"> </span><span style="color:#032F62;">failed</span><span style="color:#24292E;"> </span><span style="color:#032F62;">for</span><span style="color:#24292E;"> </span><span style="color:#032F62;">&#39;https://github.com/andatoshiki/andatoshiki.git/&#39;</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><p><code>git push</code> to GitHub remote branch failed via https protocol</p><h2 id="solution" tabindex="-1">Solution <a class="header-anchor" href="#solution" aria-label="Permalink to &quot;Solution&quot;">​</a></h2><h3 id="solution-1" tabindex="-1">Solution 1 <a class="header-anchor" href="#solution-1" aria-label="Permalink to &quot;Solution 1&quot;">​</a></h3><blockquote><p>If you enabled two-factor authentication in your GitHub account you won&#39;t be able to push via HTTPS using your accounts password. Instead you need to generate a personal access token. This can be done in the application settings of your GitHub account. Using this token as your password should allow you to push to your remote repository via HTTPS. Use your username as usual.</p></blockquote><p>You may also need to update the origin for your repository if it is set to HTTPS. Do this to switch to SSH:</p><div class="language-bash vp-adaptive-theme line-numbers-mode"><button title="Copy Code" class="copy"></button><span class="lang">bash</span><pre class="shiki github-dark-dimmed vp-code-dark"><code><span class="line"><span style="color:#F69D50;">$</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">git</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">remote</span><span style="color:#ADBAC7;"> </span><span style="color:#6CB6FF;">-v</span></span>
<span class="line"><span style="color:#F69D50;">$</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">git</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">remote</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">set-url</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">origin</span><span style="color:#ADBAC7;"> </span><span style="color:#96D0FF;">git@github.com:</span><span style="color:#ADBAC7;">$USERNAME</span><span style="color:#96D0FF;">/</span><span style="color:#ADBAC7;">$REPONAME</span><span style="color:#96D0FF;">.git</span></span></code></pre><pre class="shiki github-light vp-code-light"><code><span class="line"><span style="color:#6F42C1;">$</span><span style="color:#24292E;"> </span><span style="color:#032F62;">git</span><span style="color:#24292E;"> </span><span style="color:#032F62;">remote</span><span style="color:#24292E;"> </span><span style="color:#005CC5;">-v</span></span>
<span class="line"><span style="color:#6F42C1;">$</span><span style="color:#24292E;"> </span><span style="color:#032F62;">git</span><span style="color:#24292E;"> </span><span style="color:#032F62;">remote</span><span style="color:#24292E;"> </span><span style="color:#032F62;">set-url</span><span style="color:#24292E;"> </span><span style="color:#032F62;">origin</span><span style="color:#24292E;"> </span><span style="color:#032F62;">git@github.com:</span><span style="color:#24292E;">$USERNAME</span><span style="color:#032F62;">/</span><span style="color:#24292E;">$REPONAME</span><span style="color:#032F62;">.git</span></span></code></pre><div class="line-numbers-wrapper" aria-hidden="true"><span class="line-number">1</span><br><span class="line-number">2</span><br></div></div><h3 id="solution-2" tabindex="-1">Solution 2 <a class="header-anchor" href="#solution-2" aria-label="Permalink to &quot;Solution 2&quot;">​</a></h3><p>GitHub username &amp; password/access token mismatched due to prior temporary Git config setup → Reset Git global username &amp; email config or in current repository</p><p><strong>To set your global username/email configuration:</strong></p><ol><li>Open the command line.</li><li>Set your username: <code>git config --global user.name &quot;FIRST_NAME LAST_NAME&quot;</code></li><li>Set your email address: <code>git config --global user.email &quot;MY_NAME@example.com&quot;</code></li></ol><p><strong>To set repository-specific username/email configuration:</strong></p><ol><li>From the command line, change into the repository directory.</li><li>Set your username: <code>git config user.name &quot;FIRST_NAME LAST_NAME&quot;</code></li><li>Set your email address: <code>git config user.email &quot;MY_NAME@example.com&quot;</code></li><li>Verify your configuration by displaying your configuration file: <code>cat .git/config</code></li></ol>`,14);function u(d,h,F,m,g,A){const a=o;return e(),l("div",null,[c,t(a,{readTime:"1",words:"271"}),y])}const C=n(i,[["render",u]]);export{E as __pageData,C as default};
