Using git and github

I hate GIT

Common Commands

  • fetch - Downloads from a remote repository and updates the remote tracking branches.
  • merge - Join two or more development histories together
  • pull - Download the changes and merges them into working code
  • push - Update remote refs along with associated objects
  • commit - Record changes to the repository
  • checkout - Switch branches or restore working tree files
  • clone - Clone a repository into a new directory

Create a New Repository

Local Repository

Create a new local Git repository

  • Make a new local directory and change to it
  mkdir hello-world
  cd hello-world
  • Initialize a new local Git repository
  git init
  • Add files to Git repository
  • Add files to repository and make initial commit to the local repository
  git add .
  git commit -m "Initial commit"

github Repository starting from a local git repository

  • Create a local repository
  • Create a new GitHub repository
    • Navigate to github.com
    • Press the plus symbol in the top right corner
    • Select ‘New repository‘ option
      • Do NOT add README or .gitignore files!
  • Push files to the GitHub repository
    • Note that “origin” can be any name
    • Use “git@github.com:” for SSH access with key file (.ppk file created with Putty)
    • Use “https://github.com/” or https access with github username/password
  git remote add origin <git@github.com:/><git-username>/<git-repo-name>.git
  git branch -M master
  git push -u origin master

or

  git remote add origin <https://github.com/><git-username>/<git-repo-name>.git
  git branch -M master
  git push -u origin master
  
  

github Repository starting with a github repository

  • Create a new GitHub repository
    • Navigate to github.com
    • Press the plus symbol in the top right corner
    • Select ‘New repository‘ option
  • Clone github repository to local repository
  git clone
  • Add files to local repository
  git add
  • Push files to the GitHub repository
  git push
  

Work Flow

Start daily development with a “pull”. Then “commit” as necessary.

When ready to update master repository do a “push”.

Sync Dialog - Provides an interface for all operations related with remote repositories in one dialog including push, pull, fetch, remote update…

Forking

Tagging / Release

Configuration

Use PuTTY key generator to make public/private pair On server (i.e. github.com) make sure public key is uploaded

Settings | Git

  Set "local" credentials for a project

Settings | Git | Remote

  Make sure URL is github "SSH" clone
  Put in path to private key that matches public key above

Linux


Make public/private pair

ssh-keygen -t rsa -b 4096 -C "*******@baggerman.org"
  password = **********

Add your SSH private key

ssh-add ~/.ssh/*********

https://github.com/bbaggerman/irig106lib.git