Skip to main content

Git Usage in Ubuntu

Here’s some commands and such for accessing git from Ubuntu:

Use this to mount the bliss.git repository from 192.168.1.211, to /mnt/oga:
sudo mount -t cifs //192.168.1.211/oga/bliss.git /mnt/oga -o username=glwhite,noexec

This command will clone the above repository to a working folder, /mnt/bliss
git clone /mnt/oga /mnt/bliss

This command will update the working copy with updates from the git server:
git pull origin main

NOTE: for older, non-PC, repositories, use master instead of main.

This command will commit changes to the local working copy:

git add -A; git commit -m "some comment"

This command will push the commit local changes to the remote repository:

git push origin main

 

If you ever see an error like this: GitHub · Build and ship software on a single, collaborative 

The authenticity of host '(140.82.112.3)' can't be established. ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU.

Execute this command to clean up the hosts file for github.com entries:

sudo ssh-keyscan github.com >> ~/.ssh/known_hosts

Problems that come up…

When you see:
Updates were rejected because the tip of your current branch is behind its remote counterpart
Do this:
git pull --rebase


To revert the checkout folder to the latest, do this:
git reset --hard HEAD

Cloning a GitHub Repository over SSH

See this: A quick GitHub SSH clone example