Vault/git_basics.html

14 lines
736 B
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<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>