The document provides instructions for generating an SSH key, adding it to GitLab, installing Git, cloning a repository, creating and switching branches, committing and pushing code to the remote repository. It outlines the steps to generate an SSH key using ssh-keygen, copy the public key, add it to GitLab preferences, install Git, clone a repository, create and checkout branches for assignments, stage files and commit changes locally, and push the commits to the remote repository.
The document provides instructions for generating an SSH key, adding it to GitLab, installing Git, cloning a repository, creating and switching branches, committing and pushing code to the remote repository. It outlines the steps to generate an SSH key using ssh-keygen, copy the public key, add it to GitLab preferences, install Git, clone a repository, create and checkout branches for assignments, stage files and commit changes locally, and push the commits to the remote repository.
The document provides instructions for generating an SSH key, adding it to GitLab, installing Git, cloning a repository, creating and switching branches, committing and pushing code to the remote repository. It outlines the steps to generate an SSH key using ssh-keygen, copy the public key, add it to GitLab preferences, install Git, clone a repository, create and checkout branches for assignments, stage files and commit changes locally, and push the commits to the remote repository.
● Enter the command on the home directory ssh-keygen
● It will ask you to enter the file name in which you want to save the private and public key, Press Enter to select the default provided file. ● Next, it will ask for the Passphrase. Press Enter to select the default settings ● Enter the command cat .ssh/id_rsa.pub This will give you your public key. Copy it.
● Open gitlab 1. Go to Preferences in the top right corner
2. Click on the SSH Keys on the left side
3. Paste you ssh key in the box
4. click Add key
This will add the SSH key to GIT client i.e. Gitlab GIT
● Installing GIT sudo apt install git-all
● Cloning the repository
git clone <ssh-link> This will clone the repository to your local machine
● Creating branch
1. git branch c_assignments
this will create a branch with the name c_assignment 2. git checkout c_assignments this will switch branch with the name c_assignment 3. create a directory based on your need (i.e. set0, set1, set2 and put the code of the respective assignment in those folders)
● Commit and pushing
1. To add files to the staging area
● git add <file/folder name(s)> ○ e.g. git add set1_q1.c set2_q2.c ….. ● To add all the files in one go use wildcards ( . ) ○ git add .
2. To add file to local repository
● git commit -m “<some commit message>” Note : Commit messages have to be small and to the point. It should explain to you about the commit. ● First time there might be a need to set your email address and LDAP user name. To do this follow below commands ○ git config --global user.email "email@vayavya.com" ○ git config --global user.name "LDAP_USER_NAME” 3. To push to remote repository ● git push ○ If it asks for the upstream to be set please do that (this will be displayed on your terminal)