Hands-on Activity 2: Install and configure your repository in remote Git in GitHub

This activity showcases how to synchronize or upload a local git repository online as a remote repository on github. It also tackles how to clone a remote repository on a local machine and keep track of its changes as well.


Objectives

  • Create a local directory and link it in a centralized repository in Github.

Output

1) Create a github account and proceed on creating a profile repository (named as ‘username’).


2) Clone repository.

localhost:~# git clone https://github.com/jpcabral-tip/jpcabral-tip.git
localhost:~# cd jpcabral-tip


3) Create README.md inside repository.

localhost:~/jpcabral-tip# touch README.md


4) Modified README.md.

localhost:~/jpcabral-tip# vim README.md
<b>Year Level: </b>Third Year

<b>Interests: </b>Penetration Testing

<b>Email Address: </b>qjpccabral@tip.edu.ph

#### Computer Specs
*<b>CPU: </b>Ryzen 7 4800H (8 Cores 16 Threads)
*<b>RAM: </b>16 GB DDR4 3200 MHz
*<b>Disk: </b>SSD 256 GB, HDD 500 GB


5) Commit and push to remote repository.

localhost:~/jpcabral-tip# git add README.md
localhost:~/jpcabral-tip# git commit -m "First commit"
localhost:~/jpcabral-tip# git push origin master


6) Forked https://github.com/ajcanlas-tip/sysad2-12021.git repository.


7) Clone forked repository.

localhost:~/jpcabral-tip# cd ~
localhost:~# git clone https://github.com/jpcabral-tip/sysad2-12021.git
localhost:~# cd sysad2-12021


8) Created activity2 branch

localhost:~/sysad2-12021# git checkout master
localhost:~/sysad2-12021# git branch activity2


9) Switched to activity2 branch

localhost:~/sysad2-12021# git checkout activity2
localhost:~/sysad2-12021# git status


10) Added an upstream repository.

localhost:~/sysad2-12021# git remote add upstream https://github.com/ajcanlas-tip/sysad2-12021.git


11) Copy previous README.md as HA2.md.

localhost:~/sysad2-12021# mkdir jpcabral-tip/
localhost:~/sysad2-12021# cd jpcabral-tip
localhost:~/sysad2-12021# mkdir activity2
localhost:~/sysad2-12021/activity2# cd activity2/
localhost:~/sysad2-12021/activity2# cp ~/jpcabral-tip/README.md HA2.md
localhost:~/sysad2-12021/activity2# ls


12) Push to activity2 branch.

localhost:~/sysad2-12021/activity2# git add .
localhost:~/sysad2-12021/activity2# git commit -m "First commit for activity2"
localhost:~/sysad2-12021/activity2# git push origin activity2


13) Open a pull request for the master branch of the upstream with the activity2 branch.


14) The request can be viewed under the ‘Pull requests’ tab of the upstream repository.


As seen on Github.