Working with Git

The task for this week was to get myself use to git and build my personal website.
This week was the most hectic and confusing week for me to get a hold over git which was very new to me.

So what is Git?

While going through so many videos and web tutorials in nut shell i understood that its basically a Version control system.
A Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
Like taking the example of Fablabs the Individual Students form some projects, the collection of projects or group of projects forms a lab, and the group of labs basically forms the fablab network.You can read more about it frome this tutorial.

Installing and playing with git

As advised by Neil I made a test account on gitlab just to play and push my folders to the repos. A link to the test account is here
So what are repositories? After a heck of confusing week irritating my instructors i get to know repositories are basically a folder on the cloud where you create your projects
Since it is a distributed system and open source like your work can be seen by the people and the people who have the permission like your project member could actually modify it. Initially it was all so scaring but after few hours of mind boggling sessions I was trying to get in a habit of it.


The work flow to setup git is as follows

  • Installing Git Bash-

    Git works on linux based systems and in windows there is a subsystem of linix.The Gitbash allows us to work on the terminal like linux you can also do change Using the GUI of gitlab but having a hands on CLI is better.
    You can download git bash from here

  • Setting up SSH Key-

    The SSH protocol provides this security and allows you to authenticate to the GitLab remote server without supplying your username or password each time.
    Basically SSH encrypts your files to send it from your local machine to the repo via remote server.For more info you can refer this tutorial by Digital Ocean
    The command to generate pubic ssh key i used was
    ssh-keygen -t rsa -C "my_email@example.com"

    Now copy the key and paste it to the gitlab account

  • Initializing git-

    One way is to go to the directory where you want to initialize the git the easier way for windows is to just right click over the folder and select Git bash here,after tht type following commands
    git init

  • Configuring the git-

    Typing the following commands to configure with your email and username for one time so that you don't have to enter all the time
    git config --global user.name "My Name"
    git config --user.email "my email"

  • Cloning the repo to your local machine-

    Basically this command actually make a copy of your repository present on git to your local machine.The command is
    git clone https://paste the link

  • Checking the status-

    Checking the status tells the current scenario what is happening to your repo how many files are ther which are not added everything should come responsive
    git status

  • Pushing the Files-

    To send the file to your repository basically three commands are written in this sequential manner-
    git add .
    git commit -m "your message"
    git push
    the "add."" command takes all your files in that folder to send it to your repo, the commit allows you to write a relevant message before pushing your files and the push finally pushes the files to your repo. After you refresh the gitlab account you will find all the files that were on your local machine will now also appear on the gitlab repo.

Experience

Initially to a noobie like me it gives of a feel of being like a 'hackerman' doing all the push and pull for the first time using the commamnd line interface and everything is so new, overall it's a great project management tool where one can collaborate and showcase one's work and all can be achieved in a continuous integration process.
What I understood by using it that ,It has a MASTER line like consider it a ling holloe pipr from where water can flow, and every other user is pushing their water from their small-small indiviual branches of pipes to the main branch to that pipe line.The above theory is all imagination just for a nothing could be actually true but just to understand from my perspective i like to breakdown them into little exmaples.

Website Building

After the most difficult part this was one of challenging as well as inetersting part.This year by default a demo website is already made by the lab. It's based on MkDocs which is a static site generator. The files are written in MarkDown with a single YAML configuration file.

For building the website I opted to make it from the scratch. I statrted getting used to html
I guess the best tutorial is given in W3Schools . But just getting the html was no good in appearance I started learning about bootstrap and CSS for styling and getting used to it.

  • MkDocs-

  • So as already mentioned this year MkDocs is used as a static site generator the good thing about it I liked is that we can simultaneously preview that how Our website will be displyed over the web

    Experience


    For a layman/fresher like me getting hold of it is comparatively difficult than html and css also for it we need to install Python and the pip package manager in your local system for editing of the website
    I tried to to it but failed miserably . The problem occured because I was not giving the right path where my python.exe was installed.After a heck of breaking my head i switched to form it via html+css framework.
    Unfortunately I did not take any screen shots of the process of isntalling pyhton making path and installing pip package but I had a knack initially for making my own template using html+css so I very early didn't give much time in understanding the whole process of MkDocs rather than invested my time for learning HTMl editing a template.

  • HTML-CSS-BOOTSTRAP-

    They are comparatively easy to understand and apply for me. I downloaded various themes from here and tried editing it via Sublime text , apart from sublime there are other text editors too for instance i first started editing in notepad and save the file in .htm extension, but sublime allows you to preview your webpage before publishing it and it has a good working environment i tried Atom but sublime worked for me.

    Understanding Bootstrap


    Bootstrap can be added via adding a link in the stylesheet or it can be downloaded, I used the CDN(adding a link to my stylesheet). It divides our page into 12 equal column and we can customize the part which we want to add text or a picture basically it was the best feature I explored and it helped me editing my templates faster.

    Working for the Website-

    For making my own website I downloaded various themes from freecss.com and looked for the best one that pleased me.


    I downloaded Various layout and tried editing them in sublime text editor.

    For editing the best way I found that in Google Chrome browser if u press
    ctrl+shift+i
    It will show you the source code of the current page and by clicking on the pointer if u go to any section the web page it will point to it's corresponding code in html which made it easy for editing a big line of code in sublime text editor also You can find the erors if any thing happens to the web page.

    Experience-
    Initially it was all fuzzy observing the css files and the html files and adding my own imagination to the framework, but as soon as i got used to it it was the fun game, Here are some snapshots of my website during buildup process-


    Basically there are tagsfor attributes in html like
    h tag for headings
    p for paragraph
    br to break the line
    and the class attribute specifies one or more classnames for an element. The class attribute is mostly used to point to a class in a style sheet.
    One can use a div tag or section tag to make a division or section of a page
    Ater getting a lil bit used to them and heck of editing...
    tadaa finally my own website was online on the Fab Archive.


Working towards issues
Updated on 3rd march

My instructor opened an issue on the issue tracker and I received a feedback on changing the layout for my weekly assignments.
Initially I was too scared coz a lot of documentation was already done and a lot was left but then realizing the haphazardness of the presentatbility of the workflow I decided to change my website as well as my assignment pages.
I looked for a good neat thhem fro FreeCss.com and edited it to be my new website.
I also learned some Javascript and added a counter for the end of journey in my main page.
I found a neat theme for documentation from KeenThemes and shifted all my data from old to new layout.

Old layout
New layout


Weekly Documentation Layout

Earlier
Now

Personal Outcome

Issues Faced

Even after pushing my web on the repo my wesite was not displayed, I was really worried about it then My instructor Rahul Gautam and Darshan Shah came as a saviour.
I was explained that the YAML files contains the template that how our webpage will be displayed over the net, I had the old YAML file that was for Markdown so I needed to generate a new Gitlab-CI-YAML file for the html template. It is basically Lifeline and Heart of Continuous Integration process. It contains the definition of projects pipelines, jobs and environment. . It contains some jobs with constraint that when these jobs will be runnning. It can be done on the gitlab by creating a new gitlab CI-yml files by using the existing template from the option, it will automatically create the files.


Adding a template
The template created.
Also I was unaware that the first file that was to be created it's name was to be given as index.html so I renamed the website name to index.html and then pushed it into the git repo.
First You need to delete all the existing files from your git repo and then generate a new template for html css framework and then push from local machine to the git repo.

Sometimes it's the small things that we miss count's a lot this what happened to me because of this I wasn't able to push my work by the due time. But at the end I learned something from it.

HandsOn working with Git

After watching how Neil magically displayed us on the 3D printing and scanning review how to reset our repo. I also felt to try the same and literally he did that in so amazing manner I watche the above video on loop for over 50 times to get what was actually being done.

Steps I followed to reset
PS what I understood from it


Although when I tried to see the log byr the command

git log

On the system the history was wiped but on my gitlab accound no commits or history was deleted so ,
I thought that it will take a bit more time to understand the git world
To me Neil did all the things so Fast I wasn't able to follow him correctly any how
For this I hampered my some assignmnet so my instructor suggested to move ahead with assignment
However I'll see how to curb this issue in future.



Contact Me

Location

Ghaziabad, India

Student Agreement

Agreement
Top