How to Clone Central Repository (GitHub) in Git
In this article,we will see How to Clone Central Git Repository in Git.
Implementation Steps
- Logging to GitHub Account.
- Copy Central Repository URL.
- Create Clone Repository by using URL.
- Verify files/commits in Clone Repository.
- Create a new file “latest” and add content to the file.
- Add and commit the file “latest”.
- Push commits from Local Repository to Central Repository.
- Verify file in Central Repository.
First we need to go GitHub main page by using below link.
Logging to GitHub Account
Provide username and password and click on Sign in.
Click on existing repository “Ramesh-Ktexperts/AWS”
Copy Central Repository URL
Go to Clone or download, copy the central repository URL.
https://github.com/Ramesh-Ktexperts/AWS.git
Create Clone Repository by using URL
Go to Linux Terminal and paste the central repository URL
we have to enter git clone then paste central repository URL which was copied earlier.
1 2 3 4 5 6 7 |
[root@ip-172-31-42-20 ec2-user]# git clone https://github.com/Ramesh-Ktexperts/AWS.git Cloning into 'AWS'... remote: Enumerating objects: 38, done. remote: Counting objects: 100% (38/38), done. remote: Compressing objects: 100% (38/38), done. remote: Total 38 (delta 0), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (38/38), done. |
We can see the repository has been cloned successfully.
To see the repository
1 2 |
[root@ip-172-31-42-20 ec2-user]# ls AWS mumbaigit |
Verify files/commits in Clone Repository
Go inside the Repository “AWS”
1 2 |
[root@ip-172-31-42-20 ec2-user]# cd AWS [root@ip-172-31-42-20 AWS]# |
To see list of files regarding to the repository “AWS”
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
[root@ip-172-31-42-20 AWS]# ls 10.Amazon S3 Versioning.txt 11.Life CyCle Management.txt 12.Share S3 bucket with another AWS Account(CLI).txt 13.IAM (Identity and Access Management).txt 14.IAM Roles.txt 15.Manage AWS Account through WIndows - CLI.txt 16.Manage AWS Account through Amazon Linux - CLI.txt 18.VPC Part - 1.txt 19.VPC Part - 2.txt 1.EC2 - Linux.txt 20.VPC Part - 3.txt 21.VPC Part - 4.txt 22.VPC PART - 5.txt 2.Web Server Commands.txt 3.Elastc Load Balancer.txt 5.Simple Storage Service(S3).txt 7.Cross Region Replication(CRR) in S3.txt 8.Static Website Hosting.txt 9.Cross Region Replication With Another AWS Account.txt AWS CLI.txt Change an Amazon EC2 Instance Type for Linux Server.txt CloudFront Distribution.txt Cloud Watch with Custome metrics.txt Create AMI and Launch Amazon EC2 Instance from AMI.txt Create MySQL DB Instance in RDS.txt Cross Account Access.txt Dynamo DB.txt EFS (Elastic File System).txt Increase the Size of an EBS Volume Attached to a Linux Server.txt Project - 1 Route 53 PART - 1.txt Route 53 PART - 2.txt Route 53 PART - 3.txt SNS (Simple Notification Service).txt VPC FlowLogs - CloudWatch.txt VPC Peering.txt |
To see the list of commits
1 2 |
[root@ip-172-31-42-20 AWS]# git log --oneline 1333400 Add files via upload |
Create a new file “latest” and add content to the file
1 2 3 |
root@ip-172-31-42-20 AWS]# vi latest [root@ip-172-31-42-20 AWS]# cat latest This is my latest code |
Add and commit the file “latest”
Adding file to Staging Area
1 |
[root@ip-172-31-42-20 AWS]# git add . |
Commit the file into Local Repository
1 2 3 4 |
[root@ip-172-31-42-20 AWS]# git commit -m "latest commit" [master 6179352] latest commit 1 file changed, 1 insertion(+) create mode 100644 latest |
To see the list of commits
1 2 3 |
[root@ip-172-31-42-20 AWS]# git log --oneline 6179352 (HEAD -> master, origin/master, origin/HEAD) latest commit 1333400 Add files via upload |
To see the latest commit
1 2 3 4 5 6 |
[root@ip-172-31-42-20 AWS]# git log -1 commit 61793525e18bc7f74accf00c3afc42c91d23eeea (HEAD -> master, origin/master, origin/HEAD) Author: Ram <ram@gmail.com> Date: Tue Dec 24 10:47:43 2019 +0000 latest commit |
To see the data of latest commit
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
[root@ip-172-31-42-20 AWS]# git show 6179352 commit 61793525e18bc7f74accf00c3afc42c91d23eeea (HEAD -> master, origin/master, origin/HEAD) Author: Ram <ram@gmail.com> Date: Tue Dec 24 10:47:43 2019 +0000 latest commit diff --git a/latest b/latest new file mode 100644 index 0000000..1505aa1 --- /dev/null +++ b/latest @@ -0,0 +1 @@ +This is my latest code |
Push commits from Local Repository to Central Repository
1 2 3 4 5 6 7 8 9 10 |
[root@ip-172-31-42-20 AWS]# git push origin master Username for 'https://github.com': Ramesh-Ktexperts Password for 'https://Ramesh-Ktexperts@github.com': Counting objects: 3, done. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 278 bytes | 278.00 KiB/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), completed with 1 local object. To https://github.com/Ramesh-Ktexperts/AWS.git 1333400..6179352 master -> master |
Verify file in Central Repository
Go inside your GitHub and hit refresh of your browser.
we can see file and commit message.
To check data of the file
Click on latest to open.
We can the data “This is my latest code” of file.”latest”
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates
KTEXPERTS is always active on below social media platforms.
Facebook : https://www.facebook.com/ktexperts/
LinkedIn : https://www.linkedin.com/company/ktexperts/
Twitter : https://twitter.com/ktexpertsadmin
YouTube : https://www.youtube.com/c/ktexperts
Instagram : https://www.instagram.com/knowledgesharingplatform
Priya
Thanks for making this article
santhi
It’s good website for beginners to understand from the basics .It’s really helpful.Thank you