jueves, 1 de agosto de 2024

Git first steps

 Just quick notes to initiate and manage a git repository.



alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git init

hint: Using 'master' as the name for the initial branch. This default branch name

hint: is subject to change. To configure the initial branch name to use in all

hint: of your new repositories, which will suppress this warning, call:

hint: 

hint: git config --global init.defaultBranch <name>

hint: 

hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and

hint: 'development'. The just-created branch can be renamed via this command:

hint: 

hint: git branch -m <name>


alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git remote add origin https://github.com/alegarciadelrio/kubernetes.git


ajandrogarcia@MacBook-Air-de-Alejandro kubernetes % git branch -M main


alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git pull origin main

remote: Enumerating objects: 4, done.

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

remote: Compressing objects: 100% (4/4), done.

remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0)

Unpacking objects: 100% (4/4), 12.76 KiB | 653.00 KiB/s, done.

From https://github.com/alegarciadelrio/kubernetes

 * branch            main       -> FETCH_HEAD

 * [new branch]      main       -> origin/main

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git add .           

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git commit -m 'Add nginx with ingress example'


If it is your first time using git, maybe you need to configure the author.

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git config --global --edit



# Generate access token with this link, then when you pull use the 

https://docs.github.com/es/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens

alejandrogarcia@MacBook-Air-de-Alejandro kubernetes % git push -u origin main                        

Enumerating objects: 9, done.

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

Delta compression using up to 4 threads

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

Writing objects: 100% (8/8), 1.24 KiB | 633.00 KiB/s, done.

Total 8 (delta 2), reused 0 (delta 0), pack-reused 0

remote: Resolving deltas: 100% (2/2), done.

To https://github.com/alegarciadelrio/kubernetes.git

   4782499..bcd1bff  main -> main

Branch 'main' set up to track remote branch 'main' from 'origin'.



Maybe another commands:
git checkout -b new-branch
git branch

No hay comentarios:

Publicar un comentario