Skip to content

Getting and using Git and Github

Nils Olsson edited this page Sep 9, 2013 · 1 revision

The purpose of this page is to help members get started and get comfortable with Git and Github.

Here we will cover...

  • Downloading, installing and running Git from the Git-SCM website
  • Various common Git commands and how to find out more about them

...with the goal of being able to...


Because it is available to all operating systems in the same form, the default Git Bash (commandline) will be the primary focus of this document. If you're using a Linux distribution you probably know what you're doing can follow all the commandline instructions but with the Linux terminal (as opposed to the Git Bash on Windows or MacOS). Introductions on GIT Gui and the Windows/MacOS Github GUI applications see (future) sections below.


1. Get and install

First off, navigate to the local repository with a Git enabled shell.

  • Repositories on your drive contain a hidden .git directory, containing the configurations for that repo
  • If there is no .git directory, there is no repo!.
Git Shell

Snapshotting

  • Status Show the working tree status
    • Basic use: git status
  • Add Add file contents to the index
    • Basic use: git add -A
    • -A Find new files, modified content and removed files (no longer in the working tree).
  • Commit Record changes made to the repository
    • Basic use: git commit -m "One line summary of changes"
    • -m <msg> Use the given <msg> as the commit message.

Updating projects

  • Push Update remote refs along with associated objects
    • Basic use: git push
    • Requires collaborator access to repository at the remote reference.

Troubleshooting

  • HTTP request failed (unable to fetch/pull)
    • error: while accessing https:...
      fatal: HTTP request failed
    • Issue: Missing copy of the intermediate certificate to verify your SSL connection.
    • Solution: git config --global http.sslVerify false Disable SSL certificate verification when fetching or pushing over HTTPS.
  • Reset local branch to remote HEAD
    • Issue: Currently checked out branch of a non-bare repository has been pushed to.
    • Solution: git fetch origin; git reset --hard origin/master