Git - A distributed version-control system

Home > General > Git

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers, but it can be used to track changes in any set of files. Its goals include speed, data integrity, and support for distributed, non-linear workflows. Wikipedia


  1. Github
  2. Obtaining a Git Client
  3. Configuring your Git Client
  4. General Git Usage
  5. Additional Resources


Creating an Account

  1. Visit
  2. Specify a username, enter your email address and a password and follow the steps
  3. Verify your email address

Creating a Repository

  1. You’ll need to have an account setup before proceeding.
  2. See the most recent page at

Obtaining a Git client

In order to interface with github effectively you’ll need a git client. From the git client you’ll be able to “push” code changes from your local folders up to github for safe keeping and version control.


  1. Visit
  2. Download the git client and run the executable
  3. Follow all on-screen instructions, the default options are usually the best.
  4. You’re all set! There should have “Git Bash” available in your start menu.


sudo apt update
sudo apt install git
dnf -y update
dnf -y install git


  1. Visit
  2. Download the git client and run the executable
  3. Follow all on-screen instructions, the default options are usually the best.

Configuring your Git Client

Your git client will need to be configured correctly before you can push changes up to your repository. Execute the following commands from your terminal/git client to set your name and email address. Replace the sample information with your own.

git config --global "sampleuser"
git config --global ""

To see these changes execute

git list

Yout should see something similar to the following:

[root@host ~]# git config --list

General Git Usage

Initializing a Directory

  1. Ensure you’ve created a repository using the steps here
  2. Open git bash (terminal in linux)
  3. Ensure the directory hasn’t already been initialized
    git status
  4. If you recieve “fatal: Not a git repository (or any of the parent directories): .git” the repository is already being tracked.
  5. Otherwise, execute the following
    git remote add origin [web address of github repository]
    git add -A
    git commit -m "first commit"
    git push origin master

Pushing Changes up to a remote repository

  1. Open git bash (terminal in linux)
  2. Change your current working directory to your local repository
  3. To stage a single file you’ve changed to be pushed up to your remote repository execute
    git add ./file.txt
  4. To stage all files you’ve changed execute
    git add -A
  5. To commit the tracked changes and prepare them to be pushed to a remote repository, execute the following with your choice of message (-m)
    git commit -m "Add files"
  6. Push your changes to the remote repository
    git push origin master

If you’ve created a separate branch for your code, replace master with your branch name.

Using .gitignore

To ignore certain files in your local repository and prevent your git client from seeing them take the following steps:

  1. Add a .gitignore file to the root of your local repository
  2. Add filenames to be ignored
  3. Wildcard characters such as ‘*’ are acceptable

See for more information.

Reseting all changes since your last commit

To revert all local changes in your local repository execute:

git reset --hard

Additional Resources


This page is part of a collection of pages on various topics of Computational Neuroscience. Please direct questions and suggestions to the author Tyler Banks at