2. Project management¶
I have to build a personal site describing me and my final project. I have to upload it to the class archive. I also have to work through a git tutorial.
Git Lab is a web based repository manager, or it is simply a website to upload your repositories online.
It provides a backup on cloud
It provides visual interface to your repositories
It makes collaboration easier
Is Git =Git Lab¶
No, Git is a VCS whereas GitLab is just a website where you can put your repositories.
Git Lab can be used with any other Version control System, like Mercurial.
In the same way you can use Git with any online Version Management System like GitHub or BitBucket. There is no relation between Git and GitLab; they are two different things.
A simple Workflow¶
A remote repository is placed on a server. We can do a clone/pull to take all the repositories present here into our local system. So here we can get all the repositories. Let us say, we have all these 4 repositories or different branches of the repositories. Now we can take or check out any branch. It will create a working copy for us and now we can do all our work on our working copy, we can be offline for this and we can do all the changes here. Once we are done with our changes, we can do a “add” command. “Add” command will put all our changes on a staging area, it will still not commit the changes but just put on a staging area. Then we have to execute a “commit” command which will make all our changes and commit it to the local repository. Even at this point, the changes are still not made on the remote repository. We have to again do a “push” command which will push our changes to the remote repository.
Steps I did to learn Git and create a website¶
My Computer has Windows 10 installed. It is a lenovo thinkpad that I’m using. As I attended the first session by Prof.Neil remotely and followed the tutorials I wasn’t aware of the instructions given at my lab by my local instructors. I was supposed to install Ubuntu.
Set up Git¶
I followed this Fabacademy tutorial.
I also called my Friend Salman Faris who was a fab academy instructor whenever I was stuck and followed his instructions to the T. I downloaded Git (version 2.20.1-64-bit). When the installation ended I double-clicked the .exe. (I pressed “Next” in all of the Windows and didn’t change any setting)
As per Salman’s instructions I opened the Command Prompt.(Click Run and type cmd)
Cloning an existing repository
To obtain a copy of the project in the central repository. git clone is used to create a copy or clone of remote repositories
“git clone command in action”
Set Up GitLab and SSH¶
Here are some of the Git Commands that I used
Saving changes to repository
git add git add . will take any changed and untracked files in the repository and add them to the repository and update the repository’s working tree. This will add a change in the working directory to the staging area.
git commit git commit command is the equivalent of save. git commit is an operation that acts upon a collection of files and directories.
“adding an image and commiting it”
git push git commits can be captured and made locally, then pushed to a remote server as needed using the git push command
Building the Website¶
I needed a text editor application for editing HTML document, I can use normal notepad or Vim, GNU Nano, Visual Studio Code etc. I downloaded and used Visual Studio Code. VS code is a Open Source editor developed by Microsoft
Package manager: chocolatey¶
pip python pip install mkdocs
I opened the document mkdocs.yml and changed the palette colour from purple to black. The header colours where changed and I also removed a lot of dummy content. I changed the website name, author’s name etc
Mistakes and Learnings¶
- Downloaded wrong version
- Error: pack exceeds maximum size
“Pack exceeds maximum size” I solved it by compressing the images. The size was reduced from 4 mb(!) to less than 20 kb each file 3. Adding space to image names Initially I gave the image name as “Git Pull.jpg” and I realised that the code breaks when there is a space in the name. I changed the name to gitpull.jpg etc I also learned about the command status
“git status” 4. Change in file name of images - .jpg, .JPG, .jpeg, .JPEG are all different and cannot be interchangeable