Leave a comment

GIT

This week in class we learned GIT! The objective of the lab is to add our public key to a branch and upload it back to the professor to merge it to his master branch.

I will use git clone to clone a repository into a newly created directory on my own computer.
[root@challahar ~]# git clone ssh://sbr600@scotland.proximity.on.ca/~/certs
Cloning into certs…
sbr600@scotland.proximity.on.ca’s password:
remote: Counting objects: 10, done.
remote: Compressing objects: 100% (9/9), done.
remote: Total 10 (delta 2), reused 0 (delta 0)
Receiving objects: 100% (10/10), done.
Resolving deltas: 100% (2/2), done.

[root@challahar ~]# cd certs/

Going to read the instructions that the teacher provided
[root@challahar certs]# cat readme.txt
This GIT repo contains public certs for all SBR600 students.

Please add your public key cert, using the filename “YourMatrixID.pub”
(replace YourMatrixID with your actual Matrix ID).

To add your cert:
1. Clone this repository to your computer: git clone …
2. Create a new branch: git checkout -b …
3. Add your files: git add …
git commit …
4. Check the logs. Everything look ok? git log
5. Push your branch: git push origin YourBranch:YourBranch
[root@challahar certs]#

I will create a branch called celeste and switch to that branch with the following command:
[root@challahar certs]# git checkout -b celeste
Switched to a new branch ‘celeste’

[root@challahar ~]# cd certs/

Create a copy of my public key and rename it challahar.pub
[root@challahar certs]# cp /home/challahar/Desktop/id_rsa.pub challahar.pub
[root@challahar certs]# ll
total 12
-rw-r–r–. 1 root root 396 Feb 16 05:22 challahar.pub
-rw-r–r–. 1 root root 412 Feb 16 05:07 ctyler.pub
-rw-r–r–. 1 root root 576 Feb 16 05:07 readme.txt
[root@challahar certs]# git add challahar.pub

I will then run the command git commit which will stores the current contents of the index in a new commit along with a log message from the user describing the changes.
[root@challahar certs]# git commit -m “Added the file challahar.pub”
[celeste a4c5b6c] Added the file challahar.pub
Committer: root
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:

git config –global user.name “Your Name”
git config –global user.email you@example.com

After doing this, you may fix the identity used for this commit with:

git commit –amend –reset-author

1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 challahar.pub

[root@challahar certs]# git config –global user.email challahar@learn.senecac.on.ca
[root@challahar certs]# git config –global user.name “Celeste Allahar”

This command show the commit logs
[root@challahar certs]# git log
commit a4c5b6c069b3bd31cb9a1daaeffc2dcbd16d15b1
Author: root
Date: Thu Feb 16 05:24:00 2012 -0500

Added the file challahar.pub

commit 2bf1886ad480445e33bca5aff5251a2dc7ef986f
Author: Chris Tyler
Date: Thu Feb 16 09:55:59 2012 -0500

Edited readme.txt

commit f9dc5090b8cfa7e535473fec6d130137ef700c17
Author: Chris Tyler
Date: Thu Feb 16 09:54:29 2012 -0500

Added ctyler, edited readme

commit ed36b6aa4b27efa15e4897161f2046c6f42c41ec
Author: Chris Tyler
Date: Thu Feb 16 09:48:07 2012 -0500

Initial commit

I will then send the branch that I created back to my professor.

[root@challahar certs]# git push origin celeste:celeste
sbr600@scotland.proximity.on.ca’s password:
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (13/13), 2.03 KiB, done.
Total 13 (delta 2), reused 10 (delta 2)
To ssh://sbr600@scotland.proximity.on.ca/~/certs
* [new branch] celeste -> celeste

Leave a comment