Source Control, Git

Git is useful for backup up your project files and for sharing with others.

For now, we will only concentrate on copying a project workspace from Github to your local drive and adding this copy of local code into your own Github repository

Note there are many ways to do this and this is most likely not the best way. But I'm no Git expert.

Creating a repository on Github

  1. Create an account on Github

  2. Create the new repository on GitHub.com. I recommend naming it WSS2023

Installing Git Software


  1. Go to https://git-scm.com/download/win and download the 64 bit standalone installer for Windows. Once installed, you will be able to run Git commands in Windows Command prompt

  2. Go to https://desktop.github.com/ and download the Github desktop. This is a Git Gui app that makes using Git easier.

Copy code from Github

The shared robot code is in https://github.com/ngbengkiat/WSS2023.

  1. Open the repository in any web browser.

  2. Press code and download zip as shown in image.

  3. Unzip and put in a convenient directory, say D:\WSS\WSS2023

Adding locally hosted code to GitHub


This procedure is useful for making a directory a Git repository and pushing this new repository to a remote host like GitHub. First open a Windows command window. Change directory to your project directory. Say project is in folder d:\WSS\WSS2023. In this directory, do the following.

  1. Initialize the local directory as a Git repository.
    D:\WSS\WSS2023> git init -b main

  2. Stage and commit all the files in your project
    D:\WSS\WSS2023> git add . && git commit -m "initial commit"

  3. Add remote repository. This remote repository must be created before hand on the remote host like Github.

D:\WSS\WSS2023> git remote add origin https://github.com/ngbengkiat/WSS2023.git

  1. Push local commit to remote repository

D:\WSS\WSS2023> git push -u origin main