From e6cb2ecf99e9b266f3c14cbccc94e345d838e2c6 Mon Sep 17 00:00:00 2001 From: Patsy Date: Tue, 23 Jun 2026 21:31:04 +0200 Subject: [PATCH] sync working, files from desktop added, next files from laptop and update index.md --- git_basics.md | 18 ++++++++++++++++++ ssh_keys_and_agent.md | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 git_basics.md create mode 100644 ssh_keys_and_agent.md diff --git a/git_basics.md b/git_basics.md new file mode 100644 index 0000000..15d108c --- /dev/null +++ b/git_basics.md @@ -0,0 +1,18 @@ +# Git Basics + +## git push — remote vs branch syntax + +**Problem:** `git push -u main` throws: +fatal: 'main' does not appear to be a git repository +fatal: Could not read from remote repository. + +**Diagnosis:** Git expected a remote name but got a branch name. + +**Fix:** +git push -u origin main + +**Key insight:** The syntax is always remote first, branch second. +`origin` = where to push (the remote repository) +`main` = which branch to push +`-u` = sets origin/main as the default tracking branch, +so future pushes only need `git push` \ No newline at end of file diff --git a/ssh_keys_and_agent.md b/ssh_keys_and_agent.md new file mode 100644 index 0000000..753f2d0 --- /dev/null +++ b/ssh_keys_and_agent.md @@ -0,0 +1,40 @@ +# SSH Keys & Agent + +## SSH Keypair — per device setup + +**Problem:** No SSH key exists on the device yet. +**Fix:** +ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519 +**Key insight:** One keypair per device — not per service. Private key never leaves the machine. Public key goes to the server/Forgejo/GitHub. + +--- + +## ~/.ssh/config — Host entry with Port + +**Problem:** Forgejo runs on a non-standard port (e.g. 2222) — SSH doesn't know that by default. +**Fix:** +Host git.bujour.de + HostName git.bujour.de + User git + Port 2222 + IdentityFile ~/.ssh/id_ed25519 +**Key insight:** Port gets its own line in the config — not appended to HostName. + +--- + +## ssh-agent + ssh-add + +**Problem:** SSH asks for passphrase on every push/pull. +**Symptom:** `Could not open a connection to your authentication agent.` +**Diagnosis:** Agent isn't running yet. +**Fix:** +eval "$(ssh-agent -s)" +ssh-add ~/.ssh/id_ed25519 +**Key insight:** `ssh-agent` must be started first with `eval "$(ssh-agent -s)"` before `ssh-add` works. Agent only lives for the current session — needs autostart via `.bashrc` or `.profile` (TODO). + +--- + +## Forgejo SSH authentication — success message + +**Problem/Confusion:** After `ssh -T git@git.bujour.de` the response says "Forgejo does not provide shell access" — looks like an error. +**Key insight:** This is the success message. Forgejo (like GitHub) intentionally blocks interactive shell sessions. "Successfully authenticated" in the same message confirms it worked. \ No newline at end of file