Table of contents

  1. Configure your Git username/email
  2. Change Remote Origin
  3. Fork a Repository and Create a Pull Request
    1. To Contribute

Configure your Git username/email

You typically configure your global username and email address after installing Git. However, you can do so now if you missed that step or want to make changes. After you set your global configuration, repository-specific configuration is optional.

Git configuration works the same across Windows, macOS, and Linux. To set your global username/email configuration:

# Set your username:
git config --global "FIRST_NAME LAST_NAME"

# Set your email address:
git config --global ""

To set repository-specific username/email configuration:

From the command line, change into the repository directory.

# Set your username:

# Set your email address:
git config ""

Verify your configuration by displaying your configuration file: cat .git/config

Change Remote Origin

This is useful in case the remote repository (on GitHub maybe) is moved to a different user or organisation.

# First, let's find out what your remote's name was:
$ git remote

# Now, let's find out a bit more information about your remote:
$ git remote show origin
* remote origin
... yadda yadda yadda

# Neat, now let's get rid of it.
$ git remote rm origin

# Add, the new remote location.
$ git remote add origin path_to_new_remote

This can also be achieved by editing .git/remotes/origin file.

Fork a Repository and Create a Pull Request

To Contribute

Original tutorials:

  • Fork a repo from repo’s GitHub page.
  • Clone the forked repo to your local computer.
  • To check for remote repository location.
    git remote -v
  • To keep the local copy in sync with the original upstream repo upon pull.
    git remote add upstream
  • Fetch the branches and their respective commits from the upstream repository.
    git fetch upstream
  • Check out your fork’s local master branch.
    git checkout master
  • Merge the changes from upstream/master into your local master branch. This brings your fork’s master branch into sync with the upstream repository, without losing your local changes.
    git merge upstream/master