Git er et versjonskontrollsystem som er utviklet av Linus Torvalds i 2005. Git er et distribuert versjonskontrollsystem, noe som betyr at hver utvikler har en kopi av hele historikken til prosjektet på sin lokale maskin.
Fra nå kommer jeg til å endre fokus mer mot bruk av Ansible Navigator
Først oppretter jeg et nytt repository i GitHub. Jeg kaller det "ansible_navigator".
Jeg kommer til å installere Ansible Navigator på en egen CentOS Stream 9 server.
Jeg bruker remote - ssh extentions i Visual Studio Code for å koble meg til serveren.
Konfigurasjon av Git
Først må jeg konfigurere brukernavn og e-post for å kunne ta i bruk Git.
git config --global user.name = autom8 git config --global user.email = kontakt@autom8.no
mkdir git_ansible_navigator && cd git_ansible_navigator git clone https://github.com/autom8no/ansible_naviagtor.git
[autom8@localhost ansible_naviagtor]$ git status On branch main Your branch is up to date with 'origin/main'. Changes not staged for commit: (use "git add..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: README.md no changes added to commit (use "git add" and/or "git commit -a")
[autom8@localhost ansible_naviagtor]$ git diff README.md diff --git a/README.md b/README.md index 8ad771e..8c7d88f 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# ansible_naviagtor No newline at end of file +# ansible_naviagtor + +# GIT + +git clone https://github.com/autom8no/ansible_naviagtor.git
git add README.md
git commit -m "Oppdater README.md"
[autom8@localhost ansible_naviagtor]$ git push Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 2 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 300 bytes | 300.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 To https://github.com/autom8no/ansible_naviagtor.git c93e2fc..d669767 main -> main
[autom8@localhost ansible_naviagtor]$ git checkout -b navigator Switched to a new branch 'navigator'
[autom8@localhost ansible_naviagtor]$ git branch main * navigator
[autom8@localhost ansible_naviagtor]$ git switch main Switched to branch 'main'
[autom8@localhost ansible_naviagtor]$ git status On branch navigator Changes not staged for commit: (use "git add..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: README.md Untracked files: (use "git add ..." to include in what will be committed) ansible-navigator.log no changes added to commit (use "git add" and/or "git commit -a")
echo "**.log" >> .gitignore
[autom8@localhost ansible_naviagtor]$ git status On branch navigator Changes not staged for commit: (use "git add..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: README.md Untracked files: (use "git add ..." to include in what will be committed) .gitignore no changes added to commit (use "git add" and/or "git commit -a")
[autom8@localhost ansible_naviagtor]$ git add . [autom8@localhost ansible_naviagtor]$ git status On branch navigator Changes to be committed: (use "git restore --staged..." to unstage) new file: .gitignore modified: README.md
[autom8@localhost ansible_naviagtor]$ git commit -a -m "lagt til dokumentasjon" [navigator 59220ce] lagt til dokumentasjon 1 file changed, 3 insertions(+) [autom8@localhost ansible_naviagtor]$ git checkout main Switched to branch 'main' Your branch is up to date with 'origin/main'. [autom8@localhost ansible_naviagtor]$ git merge navigator Updating d669767..59220ce Fast-forward .gitignore | 1 + README.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 .gitignore [autom8@localhost ansible_naviagtor]$ git push