14 lines
736 B
HTML
14 lines
736 B
HTML
<h1 id="git-basics">Git Basics</h1>
|
||
<h2 id="git-push-remote-vs-branch-syntax">git push — remote vs branch
|
||
syntax</h2>
|
||
<p><strong>Problem:</strong> <code>git push -u main</code> throws:
|
||
fatal: ‘main’ does not appear to be a git repository fatal: Could not
|
||
read from remote repository.</p>
|
||
<p><strong>Diagnosis:</strong> Git expected a remote name but got a
|
||
branch name.</p>
|
||
<p><strong>Fix:</strong> git push -u origin main</p>
|
||
<p><strong>Key insight:</strong> The syntax is always remote first,
|
||
branch second. <code>origin</code> = where to push (the remote
|
||
repository) <code>main</code> = which branch to push <code>-u</code> =
|
||
sets origin/main as the default tracking branch, so future pushes only
|
||
need <code>git push</code></p>
|