diff --git a/content/tech/Beginners_guide_to_Git/images/10.png b/content/tech/Beginners_guide_to_Git/images/10.png new file mode 100644 index 0000000..dd824ce Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/10.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/11.png b/content/tech/Beginners_guide_to_Git/images/11.png new file mode 100644 index 0000000..8d24db1 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/11.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/21.png b/content/tech/Beginners_guide_to_Git/images/21.png new file mode 100644 index 0000000..7da2473 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/21.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/22.png b/content/tech/Beginners_guide_to_Git/images/22.png new file mode 100644 index 0000000..48e4d77 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/22.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/31.png b/content/tech/Beginners_guide_to_Git/images/31.png new file mode 100644 index 0000000..a3d55cc Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/31.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/32.png b/content/tech/Beginners_guide_to_Git/images/32.png new file mode 100644 index 0000000..b67af0c Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/32.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/33.png b/content/tech/Beginners_guide_to_Git/images/33.png new file mode 100644 index 0000000..c8c8976 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/33.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/34.png b/content/tech/Beginners_guide_to_Git/images/34.png new file mode 100644 index 0000000..cad97b9 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/34.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/35.png b/content/tech/Beginners_guide_to_Git/images/35.png new file mode 100644 index 0000000..f84eefc Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/35.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/36.png b/content/tech/Beginners_guide_to_Git/images/36.png new file mode 100644 index 0000000..e1ff13f Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/36.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/37.png b/content/tech/Beginners_guide_to_Git/images/37.png new file mode 100644 index 0000000..544f454 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/37.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/41.png b/content/tech/Beginners_guide_to_Git/images/41.png new file mode 100644 index 0000000..9ce8788 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/41.png differ diff --git a/content/tech/Beginners_guide_to_Git/images/42.png b/content/tech/Beginners_guide_to_Git/images/42.png new file mode 100644 index 0000000..161e239 Binary files /dev/null and b/content/tech/Beginners_guide_to_Git/images/42.png differ diff --git a/content/tech/Beginners_guide_to_Git/index.md b/content/tech/Beginners_guide_to_Git/index.md new file mode 100644 index 0000000..28e9418 --- /dev/null +++ b/content/tech/Beginners_guide_to_Git/index.md @@ -0,0 +1,146 @@ ++++ +title = "Beginner's guide to Git" +date = 2024-07-19 ++++ + +## WhatIs Git? + +Git is a version control system. It is a program that allows you to roll back changes to files before they were previously saved. +It also helps multiple people work on a project. Thus it can combine changes made by several developers. + +There are services that provide access to git repositories, the most popular is [GitHub](https://github.com/). + +## How to download someone's repository? + +1. Clone it with `git clone REPO_LINK` +```bash +git clone https://github.com/oneshotws/hackerProg +``` +First time - we will get prompt, answer `yes` (details below). + + +## Getting started - How to make repo? + +0. __Register__ on Github + +1. Create a Git __repository__ +![](./images/10.png) +![](./images/11.png) +2. Choose a __license__ + - __"MIT License"__ if you don't know what to choose + ![MIT](./images/21.png) + - __"GNU GPLv3"__ if you want your project to be free software. + ![GNU GPLv3](./images/22.png) + +3. __Clone__ (download) the repository `git clone REPO_LINK`. + + Get repo link (click on "Code"): ![](./images/31.png) + If we clone via SSH link, we will get promt: +```bash +~ ➤ git clone git@github.com:oneshotws/hackerProg.git +Cloning into 'hackerProg'... +The authenticity of host 'github.com (140.82.121.4)' can't be established. +ED25519 key fingerprint is SHA256:+DiY3wvvV6TuJJhbpZisF/zLDA0zPMSvHdkr4UvCOqU. +This key is not known by any other names. +Are you sure you want to continue connecting (yes/no/[fingerprint])? +``` + +- write `yes`, press enter. This should happen only once. +And we will get an error: + +```bash +Are you sure you want to continue connecting (yes/no/[fingerprint])? yes +Warning: Permanently added 'github.com' (ED25519) to the list of known hosts. +git@github.com: Permission denied (publickey). +fatal: Could not read from remote repository. + +Please make sure you have the correct access rights +and the repository exists. + +``` + +Previously GitHub said we have not added the SSH key to our account. + + + + 4. __Generate__ an SSH key (if you don't have one!) - `ssh-keygen` and press enter 3 times: + ```bash + ~ ➤ ssh-keygen + Generating public/private ed25519 key pair. + Enter file in which to save the key (/home/casual/.ssh/id_ed25519): + Enter passphrase (empty for no passphrase): + Enter same passphrase again: + Your identification has been saved in /home/casual/.ssh/id_ed25519 + Your public key has been saved in /home/casual/.ssh/id_ed25519.pub + The key fingerprint is: + SHA256:ut0/9NgtyQEmOozmVOUBFbnfAgScz9IkwPCKalOCff0 casual@Casual-PC + The key's randomart image is: + +--[ED25519 256]--+ + | .o.oo=oo | + | .. + * | + | . X o | + |.. . o o O o | + |..o.o .+So = o | + | .o. +o+ + o | + |.o +. E. . * + | + |. . .o . o * .| + | . . .... . | + +----[SHA256]-----+ + + ``` + Output the public SSH key with `cat` and copy it. + ``` + ~ ➤ cat /home/casual/.ssh/id_ed25519.pub + ssh-ed25519 AAAAC3NzaC1lZDI1HEX5AAAAIIMaB2mluyXjROHI8GJ2o9xfvj+uiol/GbPnwJDzZkFm casual@Casual-PC + ``` + +Next we click the "add a new public key" hyperlink and paste in our SSH public key. +![](./images/33.png) +![](./images/35.png) +(note - screenshot have different key) +This should happen only once. + + After that we will be able to download repositories via SSH and upload changes (`git push`), what will prevent problems in the future. + Run `git clone git@github.com:oneshotws/hackerProg.git`: + +![](./images/36.png) +![](./images/37.png) + + + + + + + + + + + + + + +5. __Develop__ your program. +Once you make the changes you want, upload them to the repository using: +`git add . && git commit -am 'new feature' && git push`. + + However, you will probably find that git doesn't know who you are, so it will ask you to add your email and name with `git config`. + ![](./images/41.png) + - `git add .` - adds new files to the repository (not all files are tracked in folder that will be uploaded to remote repository) + - `git commit -am 'new feature description'` - saves (commits) changes to the repository that you can rollback to later. + - `git push` - uploads them to GitHub. + + After that, our local changes will be displayed on github. + + +--- + +[Other typical Git problems.](https://ohshitgit.com/) + +--- + +Btw, it's experemental post. Do you like this approach that we deal with problem as we are doing it first time together? Or do you prefer more easier to read - step by step (HowTo) guide? + +{{< source >}} +My PHD2 presentation +{{< /source >}} +