PRINCIPLES AND PRACTICES , PROJECT MANAGEMENT

Goals of the week:

Git Tutorial

What is Git?

Git is a version-control system for tracking changes in computer files and coordinating work on those files among multiple people. Git is a Distributed Version Control System. So Git does not necessarily rely on a central server to store all the versions of a project’s files. Instead, every user “clones” a copy of a repository (a collection of files) and has the full history of the project on their own hard drive. In Git, you can always revert back to the stable state if you face any errors. Git stores this information in a data structure called a repository.

There are four fundamental elements in the Git Workflow

Image

Prerequisites

To use SSH to communicate with GitLab, you need:

Commands

  1. git add is a command used to add a file that is in the working directory to the staging area.
  2. git commit is a command used to add all files that are staged to the local repository.
  3. git push is a command used to add all committed files in the local repository to the remote repository. So in the remote repository, all files and changes will be visible to anyone with access to the remote repository.
  4. git fetch is a command used to get files from the remote repository to the local repository but not into the working directory. git merge is a command used to get the files from the local repository into the working directory.
  5. git pull is a command used to get files from the remote repository directly into the working directory. It is equivalent to a git fetchand a git merge .

Installing Git on MacOS with homebrew

To install git on macOS, git has to be downloaded to macOS by using third party package manager. For that, I went to the Homebrew to download Homebrew package manager for macOS. To download homebrew, I run installing command in macOS terminal:

Image { width: 200px; }

Step 1: Firstly, make sure you have Git installed on your mac. In the terminal and enter the following command:

Step 2: then i put in my details

$ git config --global user.name "YOUR_USERNAME"

$ git config --global user.email "YOUR_EMAILADD"

Image

To create temp file

Create a temp file in fabzero-document to store files which you want to store but dont want to show it on the fabzero-document project in website

Open terminal and type:

mkdir temp

nano .gitignore

temp/

(Text editor opens up. Type the name of the folder you want to store temporary files )

Ctrl + S (save the file)

Ctril + X (to exit)

git status

git add .

git commit -m “adding gitignore”

git push

cd sonam-dorji (to view the folder)

ls

ls -a

(to view the hidden files- the hidden files will be shown here)

Image optimization

Install image magick to the macOS

Image

Commands to optimize images :

Convert bigimage.png - resize 640*640 smallimage.png

mogrify -resize 640*640 bigimage.png

cp bigimage.png bigimage1.png

convert image1.jpg image2.jpg -geometry *400 + append stripimage

Video optimization

We can Extract videos from youtube from the terminals To install

brew install youtube -dl

To extract the video

cd sonampaldondorji/sonam-dorji/temp/ youtube -dl paste the link

To get options for resolution In the terminal

youtube -dl -F paste the link youtube -dl -f 251 paste the link

Making the website

You need not be an IT expert or even have an IT background to create a website There are many free templates available in the net I used css template to download templates. After selecting the template I edited using visual studio.

Image

Image

Image

Generating SSH keypair

To generate SSH keys in macOS, follow these steps:

  1. Enter the following command in the Terminal window.

     ssh-keygen -t rsa
    

    This starts the key generation process. When you execute this command, the ssh-keygen utility prompts you to indicate where to store the key.

  2. Press the ENTER key to accept the default location. The ssh-keygen utility prompts you for a passphrase.

  3. Type in a passphrase. You can also hit the ENTER key to accept the default (no passphrase). However, this is not recommended.

  4. You will need to enter the passphrase a second time to continue.

  5. After you confirm the passphrase, the system generates the key pair.

  6. Your private key is saved to the id_rsa file in the .ssh directory and is used to verify the public key you use belongs to the same Triton Compute Service account.

  7. Your public key is saved to the id_rsa.pub;file and is the key you upload to your Triton Compute Service account. You can save this key to the clipboard by running this:

     pbcopy < ~/.ssh/id_rsa.pub
    

Image

  1. After you copy the SSH key to the clipboard, return to your account page.

  2. Choose to Import Public Key and paste your SSH key into the Public Key field.

  3. In the Key Name field, provide a name for the key. Note: although providing a key name is optional, it is a best practice for ease of managing multiple SSH keys.

  4. Add the key. It will now appear in your table of keys under SSH

Image

Cloning and pushing the git repository

  1. Open your fabacademy profile and click on the clone and copy the SSH file

Image

  1. Go to the terminal and type the following command

     git clone paste the SSH link
     
     ls (to list the file)
     
     cd project name 
     
     git add .
     
     git commit -m “message”
     
     git push
     
     git status (to check the status)
    

Image

Final project

Image

Bhutan has over 71 percent of its territory under forest cover and is the only carbon negative country in the world. I have always considered myself very fortunate to be part of such a green country and I wanted to contribute towards it, be it big or the smallest way possible. That's how my interest in renewable energy grew. Studying electrical engineering has pushed my interest even more as I have learnt how greatly renewable energy helps conserve our green and beautiful forest. Bhutan already uses hydro, solar, wind and bio-energy to harness electricity. I noticed that the street lights in our country are either operated manually or timer sensors are used whereby the street lights are kept on starting from 7pm in the evening till 6 am in the morning. Street lights are very important and keep the community safe but a lot of energy is wasted when the streets are empty. That’s how I decided I wanted to work on motion sensor street lights as my final project for the fabacademy. Street lights are utilized only when needed. If the street light is powered by solar, then it's like cherry on top.

Reference

https://www.freecodecamp.org/news/learn-the-basics-of-git-in-under-10-minutes-da548267cc91/ https://docs.gitlab.com/ee/ssh/ https://www.atlassian.com/git/tutorials/git-ssh