Git Basics that I learned.
This is to show how to get started with git quick
Git is a distributed version control introduced in 2005 and is an powerful open source tool Today we will see how can we install git-cli in our systems.
Please note this is a Mac guide if you want a windows guide please let me know
- Open terminal on the mac
- Type the command “sudo apt install git -y” This will install git on the mac.
- After git installs type command git --help t know more about the commands.
- Open your gitlab account and setup the accounts (This step is the most important part)
-
After gitlab account setup open terminal create ssh key to get remote access for your local pc by using the command
ssh-keygen -t rsa -C “email” -b 4096 -
Copy The SSH Key from the location specified from the terminal use the command
~/.ssh/id_rsa.pub (remember to check your file location) - Go to gitlab Click the projects on the upper left dropdown box and Click Your Profile
- Click “SSH Keys” tab in the left-hand side of the webpage. You should get a page shown below.
- Paste the key in the box and click “Add Key”
- Verify the linking using the command given below.
ssh -T git@gitlab.fabcloud.org - Configure Credentials using the commands
git config –global user.name “Username”
git config –global user.email “email” - Open terminal use
cd $filename (to save the repo) -
git clone $ssh_link
The repo should be cloned to the folder given in filename.
Pushing a git repo
After git clone to push the made changes to the repo follow these steps.
- git pull
- git add -all
- git commit -m "message"
- git push