View on GitHub

Computer Architecture and Operating Systems

Course taught at Faculty of Computer Science of Higher School of Economics

Using Git and GitHub

We will use GitHub and Git to submit some homeworks.

Full reference on Git is available here.

Installing Git

  1. For Windows users: download and install Git. Run Git Bash.
  2. For Linux users: run command sudo apt install git in Terminal (typically it is already installed).

Generating SSH Keys

Run the ssh-keygen command in the console, to generate SSH keys. Specify the passphrase for the keys. The keys will be generated in the following folders.

id_rsa is a private key, id_rsa.pub is a public key.

Creating Repository

  1. Login into GitHub or create an account.

  2. Add your public SHH key to your account.

  3. Create a new private repository. Name it <group>_<surname>, e.g. 231_tatarnikov. If there is another student with the same surname, add suffix _<n> (n is the first letter of the name).

  4. Add the workshop instructor and the teaching assistant as collaborators to the project. Here is an example of a link to do this (Project > Setting > Manage Access):
    https://github.com/<your account>/<your project>/settings/access.

Working with Repository

  1. Clone the created repository to your machine:
    git clone https://github.com/andrewt0301/test.git
    
  2. The repository will be cloned in the test folder. Change the current directory to it:
    cd test
    
  3. See help of using Git:
    git help
    
  4. Set your user name and email for this repository:
    git config user.name Andrei Tatarnikov
    git config user.email andrewt0301@gmail.com
    
  5. Create or copy the hello.c program to this folder.

  6. Check the status of files in the Git repository:
     git status
    
  7. Add the hello.c file to the commit:
     git add hello.c
    
  8. Send the commit to the repository:
     git commit -s -m "hello.c is added"
    
  9. Update the remote repository (GitHub):
     git push origin main
    
  10. Get changes from the remote repository (GitHub):
    git pull