Two kinds of commands below: plain git commands (work with any git server, nothing
special about this one) and ssh git@git.kristoffersson.info <word> ones — those run a small
set of admin commands this server defines for itself (create a repo, set its description, delete
it). They look like git subcommands but aren't; git itself has no create,
describe, or delete built in that does this — there's no such thing as
"deleting a repo" in git, a repo is just a directory. (git *does* have its own unrelated
git describe — it prints the nearest tag reachable from a commit. Different thing
entirely from the SSH one below.)
First time on this machine? Set your identity
Every commit records who made it. Git won't guess — set this once per machine (or drop
--global to set it just for the repo you're in):
git config --global user.name "Your Name"
git config --global user.email "you@example.com"
Use the same name and email everywhere you push from, so your commits look like one person across repos when others are collaborating with you.
Cloning a repo
No account needed to read. Pick either:
# read-only, no credentials
git clone https://git.kristoffersson.info/repos/<repo>.git
# needs an SSH key registered on the server (see below) -- required for push
git clone git@git.kristoffersson.info:repos/<repo>.git
The exact command for a given repo is also on that repo's own page — click the clone box to copy it.
Everyday git
git status # what's changed
git add <file> # stage a file (git add -A for everything)
git commit -m "message" # commit what's staged
git push # send your commits to the server
git pull # fetch + merge the server's commits into yours
git log # history
git diff # uncommitted changes, in detail
git branch # list branches
git switch -c <name> # create and switch to a new branch
Putting a new project up here
Either direction works — start with a repo already on the server, or start with a folder you already have. Both need an SSH key registered here first (see below).
Already have a local folder? Turn it into a repo, then push it up:
cd my-project
git init
git add -A
git commit -m "Initial commit"
ssh git@git.kristoffersson.info create my-project
git remote add origin git@git.kristoffersson.info:repos/my-project.git
git push -u origin main # or "master" -- whatever git init used
Starting from nothing? Create the repo first, clone the (empty) result, then add files:
ssh git@git.kristoffersson.info create my-project
git clone git@git.kristoffersson.info:repos/my-project.git
cd my-project
# ...add files, then...
git add -A
git commit -m "Initial commit"
git push
Setting a repo's description
Shows up in the repo list and in the box at the top of the repo's pages here. This is the
server's own describe SSH command (see the note up top) — not git describe.
ssh git@git.kristoffersson.info describe <reponame> "A short description"
Deleting a repo
Permanent — this removes the bare repo and its whole history, no trash/undo. The name has to be typed twice as a confirmation; if the two don't match, nothing is deleted.
ssh git@git.kristoffersson.info delete <reponame> <reponame>
Getting push access
Push (and repo creation) needs your SSH public key added to the server. Send it to the admin,
or if you're the admin: sudo bash server/add-key.sh from the foxygit checkout.