Steps that can make your work half!! First select your project & open your terminal in your project’s root directory. 1. Check for Git Version git --version If it is not showing the version of git then go to the official website of and download the git according to OS of your system. git . 2 If we are setting up the git for the first time, we can configure the git with name & email. git config --global user.name "Your_Name" git config --global user.email "Your-Email" 3. Initialize Git Repository git init Note:- On your Project’s root directory It initializes the git repository in local project & will make . folder that contain important folders and files. git 4. Commiting files into the git repo. There are three steps :- : Step 1 We need to add a file to staging area . git add <File_Name> {{For Single File}} git add . {{For all the files in current Directory}} :- In place of add your file and if you want select all the files in current directory then use {{ . }} or {{ * }} Note <File_Name> :- Staging area is that area where we can buy some items and put them in bucket . Staging area To check,if files are added or not,use this: git status : Step 2 Commit a file into the git repo is to write a commit message. m = message git commit -m "First Commit" :- In the “ ”, you should write your message. Note Double Quotes : Step 3 Push the file into a remote repository. {{Github}} Now create your account on git-hub and create a repository . To add files in your remote repo use this : git remote add origin git@github.com:"Username_on_github"/"Repository_Name" :- This above command is a single command & Now place your git-hub username (without any quotes) and put your repository name (without any quotes). Note Like this git remote add origin git@github.com:XYZ/project.git And if you don’t understand this then go to your repository on git-hub and click on button and copy with SSH method. clone or download url To check git remote -v 5. Create SSH Key. Why we use SSH? By using the ssh protocol, we can connect and authenticate to remote servers and services. With ssh keys we can connect to GitHub without supplying our username and password at each visit with the help of passphrase.In HTTPS method, you will need to fill our username and password at every visit, which will be very inconvenient. Git associates a remote URL with a name and our default remote is usually called “ ” Origin 1. Generating New ssh key and adding it to a ssh agent. ssh-keygen -t rsa -b 4096 -C "email" :- Place your email in “double quotes”. Note This creates a new ssh key using the provided email as a label. 1.1. For default file Press {{ ENTER }} /home/{{username_of_pc}}/.ssh/id_rsa: ENTER 1.2. Enter a passphrase. 1.3. Now our identification has been saved in Private Key : /home/{{username_of_pc}}/.ssh/id_rsa & Public Key : .ssh/id_rsa.pub 2. Adding our ssh key to the ssh agent eval "$(ssh-agent -s)" it gives like {{agent_id : 15800}} 3. Now we add SSH Private key to ssh-agent to our default path. ssh-add ~/.ssh/id_rsa 4. Adding a new ssh key to your github account. Copy the ssh key to our clipboard. Automatic Method (Using Xclip) On Ubuntu sudo apt-get install xclip on Manjaro Open Octopi -> Download Xclip Xclip-set clip <~/.ssh/id_rsa.pub 2. Manual Method Home/.ssh/id_rsa.pub Open this file and copy your key. Now goto ➢➢ Under (Drop Down) ➢➢ ➢➢ Use {{ }} ➢➢ Then go to this directory on your computer Open this file and your . github.com Profile Photo Settings SideBar SSH & GPG Keys {{Home/.ssh/id_rsa.pub}} copy key Create new key ➢➢ Title the filed with descriptive ➢➢ Paste key into a “Key Field” ➢➢ {{ Add SSH Key }} SSH label Click on 5. Now for Testing SSH Connection. ssh -T git@github.com After running this , it will show this messege on terminal!! Hi {{ USERNAME }}! You've successfully authenticated but github does not provide shell access. 6. Final PUSH git pull --rebase origin master git push origin master : Change ‘master’ whatever branch to push. Note Then you can successfully push your file to remote server and you can setup a SSH Connection. To check the connection git log Some other useful git concepts. There are concepts that can help you to understand the git more deeply. 1. Create a new branch. git checkout -b Branch_name If you want to switch back to master branch. git checkout master If you want to delete the branch. git branch -d Branch_name 2. Update and Merge. To update local repository to the newest commit git pull To merge another branch in active branch. git merge <branch> In both cases git tries to auto-merge changes. unfortunately this is not always possible and results are in conflicts. we can merge those conflicts manually by editing the files shown by git. git add <filename> Before merging changes we can preview. git diff <source-branch> <target-branch> 3. Tagging. we can give tag (line 1.0.0) git tag 1.0.0 {{1b2eld63ff}} : {{ this is the first 10 characters of commit id. }} Note 4. Git Log. By Git Log we can study repository history. : Advanced See only the commits of a certain author. git log --author <name> Very compressed log. git log --pretty=oneline More preferable format git log --pretty=format:"%h - %an, %ar : %s" 3. It will only show the files that have changed. git log --stat 5. Replace Local Changes. git checkout --filename (if we did something wrong) then this will replace file with the last content in HEAD. If we want to drop all local changes and commits, fetch the latest history from server git fetch origin git reset --hard origin/master 6. Never forget to create your .gitignore file. ➢➢ Is a file that specifying the files or folders that we want to ignore. Gitignore file There are several ways to specifying those Firstly, you can specifying by the specific filename. Here is an example, let’s say we want to ignore a file called , then we just need to write in the file. readme.txt readme.txt .gitignore Secondly, we can also write the name of the extension. For example, we are going to ignore all files, then write . .txt *.txt There is also a method to ignore a whole folder. Let’s say we want to ignore folder named . Then we can just write in the file. test test/ Like this .gitignore file Useful Hints 1. Built in git Gui. gitk 2. Use colorful-git output. git config color.ui true 3. Use interactive adding. git add -i Some useful Article’s and Repositories {{ }} github/hub A command-line tool that makes git easier to use with GitHub 15 Git Commands You May Not Know Adding an existing project to GitHub using the command line How to become a Git expert For GitIgnore Git- gitIgnore Documentation. .gitignore file — ignoring files in Git | Atlassian Git Tutorial gitignore.io Photo by on Pankaj Patel Unsplash Lastly, You are requested to share your views on this article. :) Find something useful? Hold down the 👏 to support and help others find this article. Thanks for reading!! Follow me on Instagram :) @hypnosisss___ <a href="https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href">https://medium.com/media/3c851dac986ab6dbb2d1aaa91205a8eb/href</a>