PublicMathWiki: Git

Server

Server Info

https://git.math.uzh.ch

Software

Gitlab

Git push/pull access

mainly via SSH over git@git.math.uzh.ch - do not forget to upload your public ssh key

Cheat sheet

GIT for SVN users

Prerequisites

SSH Keys

To work with private GIT repos or to commit files, it's necessary to identify yourself. This is done via SSH Keys. Do this on all devices which you like to use with the GIT server (and in your I-MATH thinlinc session if you use it).

Git account

For members of I-MATH

For members of UZH (not I-MATH)

For non UZH persons

If you like to collaborate on a project which is hosted on https://git.math.uzh.ch, you have to request a git.math.uzh.ch account.

After the first-time login

Working with Git

git COMMAND git@git.math.uzh.ch/<username>/<projectname>

Managing your Projects with Gitlab

Gitlab has quite extensive managing capabilities.

GIT Best Practice

New project from scratch

git.project.png

Git global setup
----------------
git config --global user.name "First Lastname"
git config --global user.email "email@math.uzh.ch"

Create a new repository
-----------------------
mkdir <local projektdir>
cd <local projektdir>
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@git.math.uzh.ch:<project>.git
git push -u origin master

Push an existing Git repository
-------------------------------
cd existing_git_repo
git remote add origin git@git.math.uzh.ch:<project>.git
git push -u origin master

GIT daily use

Local: Add new files to existing repo

git add <file>

Local: Work on your files

git commit -a

git-commit

git push

Local: clone an existing repo to start working on it

git clone git@git.math.uzh.ch:<project>.git

Purged Remote branches still shown locally

$ git remote update --prune

Purge a file completely from all commits & branches

$ cd <root of your repo>
$ git-forget-file.sh <path to file>/<file>

Overwrite local branch with remote

Visually show commit history

Search the commit which breaks something

Mac OS X

git: xcrun missing

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), 
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

xcode-select --install 

Umlaute

$ git config --global core.precomposeunicode false

GIT Client

FAQ

Change Repo: http > ssh

# Status Quo
$ git remote -v show
origin  https://systemvcs.math.uzh.ch/it/typo3-docker.git (fetch)
origin  https://systemvcs.math.uzh.ch/it/typo3-docker.git (push)

# Remove Origin
$ git remote rm origin

# Set SSH Version
$ git remote add origin git@systemvcs.math.uzh.ch:it/typo3-docker.git


# Status Quo
git remote -v show
origin  git@systemvcs.math.uzh.ch:it/typo3-docker.git (fetch)
origin  git@systemvcs.math.uzh.ch:it/typo3-docker.git (push)

# Try a git pull:
$ git pull

# If you receive: There is no tracking information for the current branch. ... try:
$ git branch --set-upstream-to=origin/main main

Attention: if you change to SSH and

than you should forward your SSH-Agent! E.g. ssh root@host -A

Pipeline failed notification

Windows Change Saved Git Password

PublicMathWiki: Git (last edited 2023-10-22 16:01:43 by crose)