top of page

Basic version control using Git Hub

Updated: Aug 1, 2023

To check whether git CLI is available locally, type

which git


If not installed,

sudo apt install git

On git-hub page create a ansible-tutorial page

Add your public key to github account by

login to with your a/c

goto profile - settings - ssh and GPG keys

Add new SSH Key

Give title

login to your Ansibble controller laptop and copy the public ssh key

and paste it into github page

In the terminal type the following:

ls ~/.ssh


copy paste the ssh from terminal and paste it on the Github ssh addition box

Clone the github repository you created "ansible-tutorial" page


while copying URL from github, choose the ssh URL. Without knowing I took, https, it didn't work

git clone

Cloning into 'ansible-tutorial'...

Enter passphrase for key '/home/sambath/.ssh/id_ed25519':

remote: Enumerating objects: 3, done.

remote: Counting objects: 100% (3/3), done.

remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0

Receiving objects: 100% (3/3), done.

git config --global "Sambath Parthasarathy"

git config --global ""

To check, cat ~/.gitconfig


name = Sambath Parthasarathy

email =

if you don't confiig git willl complain

edit in /shared/TRANZ1/ANSIBLE/ansible-tutorial

git add

git add .

(instead of file name you can put .(dot), which will update the entire folder). When you type status, you get

git status

On branch main

Your branch is up to date with 'origin/main'.

Changes to be committed:

(use "git restore --staged <file>..." to unstage)


git commit -m "updated file"

git commit cmd, m for message with what did I change. Output says updated as follows:

[main 01268b4] updated README file

1 file changed, 5 insertions(+)

At this stage if you go to github oage you won't see the update

one more step, to send the chnages to the github server, as given below

git push origin main

(old command contains master, new command contains main), out looks as follows:

Enter passphrase for key '/home/sambath/.ssh/id_ed25519':

Enumerating objects: 5, done.

Counting objects: 100% (5/5), done.

Delta compression using up to 16 threads

Compressing objects: 100% (2/2), done.

Writing objects: 100% (3/3), 298 bytes | 298.00 KiB/s, done.

Total 3 (delta 0), reused 0 (delta 0)


c7528a7..01268b4 main -> main

Go back to repository and check whether modifications are updated.

You can develop code locally and keep updating the repository.

1 comentario

Obtuvo 0 de 5 estrellas.
Aún no hay calificaciones

Agrega una calificación
28 jul 2023

Very Useful for beginners!!

Me gusta
bottom of page