Assignment 1 - principles and practices, project management

git and Repositories

What is Git?

According to Wikipedia

Git is a widely-used source code management system for software development. It is a distributed revision control system with an emphasis on speed, data integrity, and support for distributed, non-linear workflows. Git was initially designed and developed in 2005 by Linux kernel developers (including Linus Torvalds) for Linux kernel development.

What I understod?

As an individual we work in FABLABS we should have the common folder where we can store our projects files, the Git is the one which enables us to do so.

How to install Git?

So, let's get started. Installation of Git will offer us the ease of access to our repositories to get the content from the repositories or taking the content out of repository.

There are two ways to install git on your Linux BOX...

  1. GUI package manager (e.g. Ubuntu Software Center, Syanptic Package Manager)
  2. Verbose package manager Terminal (e.g. apt-get, pacman, brew)

Note: I have Ubuntu 14.04 64-bit installed. For installation process you should be connected to internet

1. GUI package manager

Step 1: Open up the package manager of your choice. In my case I'll use Ubuntu Software Manger. Goto search and 'git' and return.

Step 2: Click install and wait for the process to complete.

2 . Verbose package Manager

Step 1: Open up the Terminal which is the command line environment which is capable of doing wonders! If you are on Ubuntu just hit ctrl+alt+t. Once the Terminal pops-up enter

sudo apt-get install git -y

Appending -y will eliminate the system prompt to inquire the confirmation of the package size which will be downloaded and size require to install the package. Wait for the process to take place.

Step 2: Now, your have the git installed on your BOX, let's try to check whether it is installed or not. To do so enter following command in the terminal and hit return

dpkg -s git

the first line of the output should says about the installation

Step 3: As we have installed the git, now it's time to setup authentication keys. The keys can be downloaded from here or from our Slack dicussion group.

Step 4: Unzip the downloaded folder named 'fab2016.zip' and then move the unzipped files to the folder '.ssh' located in the home directory, to do so,

cd ~/Downloads
unzip fab2016.zip

Terminal dpkg screen

this will extract the keys into the parent folder named 'Downloads'

mv fab2016 ~/.ssh
mv fab2016.pub ~/.ssh
chmod 600 ~/.ssh/fab2016

.ssh folder content

Hurrey! now we have keys in place observer the change in persmissions, but still BOX doesn't know which one to use, now let's make the BOX understand which one to use, how? as follows,

eval "$(ssh-agent -s)"    #this will ensure the ssh-client is working 
ssh-add ~/.ssh/fab2016    #this command will make BOX understand use 'fab2016' key 

Step 5: Let's try to get the data from our repository. To clone the repository you can choose your favorite folder, I'll be using my home folder to clone the repository

cd ~/           #this will take terminal to your Home directory 
git clone git@git.fabacademy.org:fabacademy2016/fablabvigyanashram.git

above command is to make the clone directory of your repository present at the git lab, the address is specific to the Fablab Vigyan Ashram. When you clone the repository it will create the new directory with the name same as repository's name this is my case it will be "fablabvigyanashram"

Step 6: Now we have to register on the github. github and sign up for the free account. Remember the username and email ID and most important thing your password!

Step 7: Let's configure the git, use the username and the email id that you've used in the previos step to sign up into the account.

cd ~/fablabvigyanashram # replace this with your repository folder 
git config --global user.name "yourname"
git config --global user.email "youremail"
git config --global push.default simple

Phew!! Now we are done to upload our assignments to the repositories!

To push out work to gitlab the workflop is as follows!

Step 1: Make all the necessary changes that you want to see.

Step 2: Now, open the Terminal and execute the following commands

cd ~/fablabvigyanashram
git pull
git add --all             # add your changes 
git commit -m "message"   # message which will identify user & purpose of commit 
git push                  # uploading process will start now! 


For making the above task simple you can download and script, remember to change it according to your local settings.

How to run script?

  1. Download the script
  2. Navigate to the your download folder
  3. Open the script in your favorite text editor do desirable settings
  4. Save, Close and follow
chmod +x push.sh   #this will add the persmissions for execution 
./push.sh          #this will make the script RUN 

Where to Vigyan Ashram's page?

FABLAB Vigyan Ashram

Trouble Shooting

Asking password for cloning and pulling repository

Dated 7th March 2016, my system started asking password even while pulling the repository on my Box.

Solution I got to know that the key that was there namely 'fab2016' was got de-activated recently for whatever the reason and that's because I was not able to push/pull/clone to my Box.

I followed following tutorial which is targeted towards generating and adding the ssh-key, this helped me solve the problem.

https://help.github.com/articles/generating-an-ssh-key/

Please follow steps from the next page where I've mentioned the process of generating and adding the personal key into the github account.

Creating and Adding own ssh-keys