0% found this document useful (0 votes)
25 views

GIT Setup and Basic Commands

The document provides instructions for setting up Git and GitHub for source control. It includes steps to install Git and Tortoise Git, generate an SSH key, clone a GitHub repository, make changes to files and create new files/folders, commit changes locally, push the changes to a new branch on the remote repository, and raise a pull request.

Uploaded by

Akash M J
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

GIT Setup and Basic Commands

The document provides instructions for setting up Git and GitHub for source control. It includes steps to install Git and Tortoise Git, generate an SSH key, clone a GitHub repository, make changes to files and create new files/folders, commit changes locally, push the changes to a new branch on the remote repository, and raise a pull request.

Uploaded by

Akash M J
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

GIT Topic Lab

1.Create signin in github.com


2. Create a test repository for 4 members / Create individual repo for
Private, Add Read me, Add gitignore None, License None and click Create
Repository

3. Download https://git-scm.com/downloads

Download and install Tortoise GIT


https://tortoisegit.org/download/

GIt Commands

Create folder by name Demo from your machine

open git bash and type below


cd ~/.ssh
cat ~/.ssh/id_rsa.pub

Copy and paste content in SSH and GPG keys of your account settings through web
application github.com

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-
a-new-ssh-key-and-adding-it-to-the-ssh-agent

ssh-keygen
ssh -T [email protected]

for old format


ssh-keygen -m PEM -t rsa -P "" -f afile

Santosh@DESKTOP-8V5OM9F MINGW64 /e/TestGuys (master)


$ ssh -T [email protected]
Hi santoshnn! You've successfully authenticated, but GitHub does not provide shell
access.

1. Precondtion
install: git tortoise and git scm bash
Setup : SSH key in Git Repo
2. Cloning the project
git clone [email protected]:santoshnn/Demo.git -- done
cd Demo/
3. Modify existing file , new File and new Folder
3.1 Modify text in README.md
vi README.md -- done

3.2 Add new File in root dir


vi newFile1.txt
add some text to it and Save it (Esc ! wq ) -- done

3.3. Add new folder with file in it.


mkdir newFolder1
vi newFolder1/newFile1
add some text to it and save it . -- done

4. Check the modified


git status -- done ( red files)
git diff README.md

5. Add files which you wish to commit


git add README.md
git add newFile1.txt
git add newFolder1/ -- done

git status -- done ( red files turns green)

6. Commit changes (changes will be commited to local not at remote branch)


git commit -m "new changes"
git status -- done ( no files)

7. view comment detail


git log (new changes shown with commit comment)
git log -3 -- done

8. Push changes to remote


8.1 View remotes and get remote name (it will be used in 8.4 step)
git remote -v

8.2 Create new branch if not there


git checkout -b newBranch

8.3 check branchs


git branch
8.4 push branch/changes
git push origin newBranch

$ git push origin newBranch


Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 4 threads
Compressing objects: 100% (2/2), done.
Writing objects: 100% (6/6), 486 bytes | 243.00 KiB/s, done.
Total 6 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'newBranch' on GitHub by
visiting:
remote: https://github.com/santoshnn/Demo/pull/new/newBranch
remote:
To github.com:santoshnn/Demo.git
* [new branch] newBranch -> newBranch

8.5 Check branch and changes in github.com project code UI

9. Raise Pull Request

git.exe clone --progress -v "https://github.com/santoshnn/Demo.git" "E:\Demo1\Demo"


Cloning into 'E:\Demo1\Demo'...

git config --system --unset credential.helper

git remote -v
ssh -Tv [email protected]

ssh-keygen -t rsa -C "[email protected]"


git remote set-url --add origin [email protected]:santoshnn/TestNew.git

git rm --cached -r

https://crontab.guru/

https://download.oracle.com/java/17/archive/jdk-17.0.4.1_windows-x64_bin.exe

FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-
ClientTools-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")
FOR %F IN ("%SystemRoot%\servicing\Packages\Microsoft-Windows-GroupPolicy-
ClientExtensions-Package~*.mum") DO (DISM /Online /NoRestart /Add-Package:"%F")

You might also like