# 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: <span data-annotation-inline-node="true" data-annotation-mark="true" data-card-url="http://github.com" data-inline-card="true" data-renderer-start-pos="766"><span class="loader-wrapper"><span data-testid="hover-card-trigger-wrapper">[<span class="css-1cwva94 e1o1fuf52" data-testid="inline-card-icon-and-title"><span class="smart-link-title-wrapper css-0 e1o1fuf57">GitHub · Build and ship software on a single, collaborative </span></span>](http://github.com/)</span></span></span>

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](http://github.com/ "http://github.com") entries:

<div class="code-block  cc-wroouh" id="bkmrk-sudo-ssh-keyscan-git"><span class="prismjs cc-zn1qqt" data-code-lang="" data-ds--code--code-block="" data-testid="renderer-code-block">`<span class="" data-ds--code--row="" data-testid="renderer-code-block-line-1"><span class="">sudo ssh-keyscan github.com >> ~/.ssh/known_hosts</span></span>`</span></div>## Problems that come up…<button aria-label="Copy link to heading" class="cc-1r0b9w7" type="button"><svg height="24" role="presentation" viewbox="0 0 24 24" width="24"></svg></button>

When you see:  
[Updates were rejected because the tip of your current branch is behind its remote counterpart](https://stackoverflow.com/questions/39399804/updates-were-rejected-because-the-tip-of-your-current-branch-is-behind-its-remot "https://stackoverflow.com/questions/39399804/updates-were-rejected-because-the-tip-of-your-current-branch-is-behind-its-remot")  
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<button aria-label="Copy link to heading" class="cc-1r0b9w7" type="button"><svg height="24" role="presentation" viewbox="0 0 24 24" width="24"></svg></button>

See this:<span data-annotation-inline-node="true" data-annotation-mark="true" data-card-url="https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/github-clone-with-ssh-keys" data-inline-card="true" data-renderer-start-pos="1299"><span class="loader-wrapper"><span data-testid="hover-card-trigger-wrapper">[<span class="css-1cwva94 e1o1fuf52" data-testid="inline-card-icon-and-title"><span class="smart-link-title-wrapper css-0 e1o1fuf57"> A quick GitHub SSH clone example</span></span>](https://www.theserverside.com/blog/Coffee-Talk-Java-News-Stories-and-Opinions/github-clone-with-ssh-keys)</span></span></span>