Git is a distributed source version control tool. Okay so what does it mean ? let's start with source version control it means that it allows us to track versions of source code as we develop any software. distributed here indicates that its not centralized server based but the history is stored in every user's own copy of the repository aka git clone
It was created by linux software foundation to help them better colloborate on linux kernel, as tools existing back then weren't good enough for their needs.
Git is the tool used to create and manage source code versioning and management, github and its competition are like dropbox/google drive which host these repositories and allow administrative functionality on top of these repositories using the git.
SSH key is a 2 part key generate by running ssh-keygen command on your machine, running this command will create 2 key files in ~/.ssh folder. although the name can be changed the default name is id_rsa and id_rsa.pub the .pub file is the sharable public key that you can show as your id card, the id_rsa file is the secret key that'll prove that you are who you say you are in the publickey.
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/uday/.ssh/id_rsa):
Created directory '/c/Users/uday/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/uday/.ssh/id_rsa
Your public key has been saved in /c/Users/uday/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:dwhVWqrTGbaIoHhqhq6xC//rgvqxeph78stH+HhjhTM uday@567aef87-74bb-4b24-bf63-0419604cc2e4
The key's randomart image is:
+---[RSA 3072]----+
| ..o |
| . + |
| . . = |
| . . . . * = |
|. o. .. S * . |
|.o. E . o . |
|=*.+ + |
|X==o* |
|X@BO+o |
+----[SHA256]-----+
id_rsa.pubnew SSH keyCloning a repository is akin to downloading a folder from google drive/ dropbox but with a super-power. Which is ... version tracking. The clone command will copy all the files along with history and setup necessary structures to operate the git command in that directory.
Go to the repository and click on clone repository which is usually the right most button on top of directory structure of a code repository. You'll have 2 ways to clone the repository one using https in which case you'd have to enter your password and username each time you clone the repository. other using ssh key which will serve as your id card when you go and fetch data from github or similar server.
originSorry ! I Don't remember, please raise it if you do
# Clone the repository one time thing
$ git clone git@github.com:udaykrishna/javaprep.git # downloads the repository and places it in the folder ./javaprep
$ git checkout -b new-branch # creates a new branch to work on my changes
$ git add file1 file2 # add in files i changed to staging area (aka select files to commit,
# equivalent to checkmarking multiple files on windows when moving)
$ git commit -m "added file1 and file2" # save my changes to git. its safe now <3
$ git push origin new-branch # telling git to push(upload) last saved state to `new-branch` branch of origin.
# Origin is default remote url which automatically gets added when cloning repository
After all this we open github and create a merge request