Using Git and GitHub
Reference on Git is available here.
Creating a repository
-
Login into GitHub or create an account.
-
Add your public SHH key to your account.
-
Create a new private repository.
-
Add the lecturer, 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 the repository
- Clone the created repository to your machine:
git clone https://github.com/andrewt0301/test.git
- The repository will be cloned in the
test
folder. Change the current directory to it:cd test
- See help of using Git:
git help
- Set your user name and email for this repository:
git config user.name Andrei Tatarnikov git config user.email andrewt0301@gmail.com
-
Create or copy the
hello.c
program to this folder. - Check the status of files in the Git repository:
git status
- Add the
hello.c
file to the commit:git add hello.c
- Send the commit to the repository:
git commit -s -m "hello.c is added"
- Update the remote repository (GitHub):
git push origin main
- Get changes from the remote repository (GitHub): ```bash git pull