Back to
version control
Version control, also known as source control, is the practice of tracking and managing changes to software code. Version control systems are software tools that help software teams manage changes to source code over time. it also keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members.
during the fab academy program we will push our website as version control each week we should document our work and upload what we learned and accomplish, there is many software’s that can enable us to do that such as Mercurial bitbucket git github gitlab Dropbox owncloud
but here we will be focusing on git and gitlab and here how you can install it and sett it up for you.
Git
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. and you can work with git in the cloud by using github that allow you do git in the cloud to collaborate or gitlab which is an open version that allow you do git in the cloud
to know more about git aloways refer back to the book ,now you need to work with git in your local computer and connect it to fab cloud to do that you need to integrated with the your terminal, and since we are using cmder emulator, you can use git bash
Git in Command Line
There are a lot of different ways to use Git. There are the original command-line tools, and there are many graphical user interfaces of varying capabilities. but here, we will be using Git on the command line. and we will use cmder since the operation system i am using is windows.
the reason we use the command line is because its the only place you can run all Git commands — most of the GUIs implement only a partial subset of Git functionality for simplicity. If you know how to run the command-line version, you can probably also figure out how to run the GUI version, while the opposite is not necessarily true.
Download git bash
Git Bash is a command line through which users can use Git features. It emulates a bash environment on Windows and lets the user use most of the standard Unix commands. you can download it from here
install git bash
once the download is done now start the installation process.
you can use git pash terminal to work with git, but here we will integrated with cmder for better use of command lines tool
Git bash + Cmder
so at this stage i spose that you already downloadded cmder and if not got to
now open cmder.exe , and the page will look like this
next click the arrow next to the green plus button in the bottom here, then click setup tasks
then click on ass/refresh defoult task, then click add new task
now you can see that there is new tasks appeared on of them will be git bash, click save and close this window
now when you click the plus sign you should see from the drop list git bash, select it and click start
Now lets make git bash the default terminal for commander, to do that click on the plus sign and hit the arrow and choose git bash from the tasks , and click Default task for new console,
next navigate to startup and for the Specified named tasks choose git bash, then click save setting
now whenever you open cmnder it will open git bash terminal
Test git in command line
now once you have already installed git you can now run the command
git version
SETUP GIT (to do only the first time)
1- git init
we will start by creating an empty repo in one of the files in our local computer
2- Add your Git username and set your email
by typing this command
git config –-global user.name “YOUR_USERNAME”
3- Configure you email address for uploading
git config –-global user.email “YOUR_email”
4- Check if you have an SSH KEY already
cat ~/.ssh/id_rsa.pub (If you see a long string starting with ssh-rsa, you can skip the ssh-keygen step)
5- Generate your SSH key
ssh-keygen -t rsa -C “$your_email”
once your done you will have private and public key like this
5- Copy your key and paste
this command will show your key in comand line, this key is private make sure to not give it to anyone
cat ~/.ssh/id_rsa.pub
open git lab
open GitLab and sign in to your page then from your avatar click preferences, then from the side bar click to ssh Keys
and then past the ssh key that you copied before and click add key, it should automatically detect the title as you write it before
create new project on git lab
now once you have created your key you can create new project from git lab, in git lab you can either start with new blank project or start with a template, here we are going to start blank project
start by writing project name and description for the project, you can initialize the repository with read me file by click the blank box
cloning repo
after you hit create project this page will show up, you can get started by cloning the repository or start adding files to it with one of the following options
push your first commit
1-Add the new files you added to git
git add index.html to upload file by file git add . to upload all the files at once
2-To download the last copy from the repository
git pull (for downloading the last copy of the repository)
3-To have a working copy of your repo
git merge (to have a working copy)
4-Now name your update, so you know what you changed with this push.
git commit -m ‘change you did’
5-AUpload to the Repository
git push
Next
before we go deep on how to build the website there is a skill you have to master which is
this tutorial based on