Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 1.59 KB

git.md

File metadata and controls

88 lines (57 loc) · 1.59 KB

A short Git primer

A more complete guide to Git can be fount here:

Installation

On Linux git should already be installed, on MacOs or Windows, refer to git downloads

Setting up the credentials

git config --global user.name "Maximilian Beuscher"
git config --global user.email "[email protected]"

SSH key setup

cd ~/.ssh
ssh-keygen -t ed25519 -C "[email protected]"

When prompted for a file name just accept with enter to get the default naming, then cat the public key and copy it to the clipboard.

cat ~/.ssh/id_ed25519.pub

Go to Account > Keys and create a new SSH Key.

Check if ssh is configured correctly:

Adding a Remote

When cloning the repository from GitHub the remote should be already configured correctly, this can be verified with

git remote -v

if not, modify the following command with your user and repository:

git remote add origin [email protected]:beuscher/repo.git

git also allows to use https, requiring a slightly different "syntax" for the remote origin.

Git Command Cheat Sheet

Add a file to the git repository:

git add *

Check the current status of the repository, it will list for example uncommitted changes

git status

Commit changes

git commit -m [commit message]

Push changes to remote

git push origin main

Pull changes fro remote

git pull origin main