Github repository and SSH key creation

  1. Add a new repo

    new repo

  2. Fill out information regarding your new remote repo

    creat repo

  3. Go to the menu in the top right and find the settings

    Settings

  4. Find the SSH and GPG keys menu

    SSH Keys

  5. Click on New SSH key

    New SSH key

  6. Give your key a name (local machine hostname) and paste in your SSH Public key found in your local home directory at “.ssh/”. It will have the “.pub” extension. This is NOT your private key. Please make sure it has the ‘.pub’ extension

    Add SSH Key

  7. You can now use git to push files from the local computer (the one you copied your public keys from) to any repo you have on github.

    git push


Local git setup

  1. Set up folder on local machine to become local repo (to be run in folder)

    git init
    
  2. Create the all important README.md

    echo "# Random Heading" > README.md
    
  3. Add a file to staging area ready for committing

    git add README.md
    
  4. If folder already populated add ALL files to staging

     git add .
    
  5. Commit file/s to be pushed to remote repo (github)

     git commit -m "First commit message: I did this & this"
    
  6. Add your github repo as a remote (using SSH)

     git remote add origin git@github.com:your-username/your-repo-name.git
    
  7. Push your staging area and commits to github (main branch - github default)

    git push -u origin main