











{"author":"Faiq Najib Al-Aziz","body":"\n![Git-scm and GitHub Logo](git-and-github_50_1_80.webp)\n\n## Introduction\n\n[Git](https://git-scm.com/) is a distributed version control system that is free and open source designed to handle everything from small to very large projects with speed and efficiency.\n\nMeanwhile, [GitHub](https://github.com/about) [is](https://en.wikipedia.org/wiki/GitHub) a complete developer platform and service for building, scaling, and delivering secure software using Git.\n\n## Git Installation\n\nGit installation for Windows is as follows,\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWindows\u003c/strong\u003e\u003c/summary\u003e\n\nFirst _download the Git installer_ at [https://git-scm.com/downloads](https://git-scm.com/downloads). Then open that installer.\n\nFollow the [next](https://www.nesabamedia.com/cara-install-git-di-windows-10/) steps. Just click _Next_, make sure it's on _default_, then _next_ again. As usual~~\n\n\u003c/details\u003e\n\u003cbr/\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eLinux (Ubuntu)\u003c/strong\u003e\u003c/summary\u003e\n\nPerform _update_ and _upgrade_ on the system with the following command:\n\n```bash\nsudo apt update \u0026\u0026 sudo apt upgrade -y\n```\n\nInstall the Git _package_:\n\n```bash\nsudo add-apt-repository ppa:git-core/ppa\nsudo apt update\nsudo apt install Git\n```\n\nVerify the Git version and ensure it's **at minimum** version 2.28[^1]\n\n```bash\ngit --version\n```\n\n\u003c/details\u003e\n\u003cbr/\u003e\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eMacOS\u003c/strong\u003e\u003c/summary\u003e\n\nFollow [these](https://www.theodinproject.com/lessons/foundations-setting-up-git#step-1-install-git) steps hehehe\n\n\u003c/details\u003e\n\n## Configure Git and GitHub\n\n### Create a GitHub account\n\nOpen [GitHub.com](https://github.com/signup) and create an account! During account setup, an email address will be requested by Git. And it must be a real email. Because contributions will be identified by _default_ by the email that will be used.\n\nConcerns about privacy, or simply not wanting your email address to be known publicly, then you can check two boxes on the Email Settings page after logging into [GitHub account settings](https://github.com/settings/emails):\n\n![email settings on GitHub account](pengaturan-email-akun-github.webp)\n\nSo, an email like ```34987164+fanajib5@users.noreply.github.com``` will be used for Git configuration.\n\n### Set up Git\n\nFor Git to work properly, users must provide information so local Git users can be linked to GitHub. When working in a team, others may see what has been done and who did what on each line of code.\n\nOn Windows, the built-in ```Git Bash.exe``` application can be used for Git configuration.\n\nThe following command will configure Git. Information inside quotation marks can be replaced with personal information **(but keep the quotation marks)!**\n\n```bash\ngit config --global user.name \"BudiTanpoHutang99\"\ngit config --global user.email \"hutangtanpo@budi.id\"\n```\n\nIf using GitHub private email, the configuration would be:\n\n```bash\ngit config --global user.email \"071367+BudiTanpoHutang99@users.noreply.github.com\"\n```\n\nThe _default_ branch on new repositories has been changed by GitHub from ```master``` to ```main```. So, change the default branch for Git using the command:\n\n```bash\ngit config --global init.defaultBranch main\n```\n\nColorful output with git can be enabled with:\n\n```bash\ngit config --global color.ui auto\n```\n\nThe reconciliation behavior of _default branch_ to _merging_ can be set with:\n\n```bash\ngit config --global pull.rebase false\n```\n\nOK! Let's try verifying the results of the Git configuration that has been done:\n\n```bash\ngit config --get user.name\ngit config --get user.email\n```\n\n### Create SSH keys\n\nSSH keys are cryptographically secure identifiers which are like very long passwords to identify user machines. GitHub uses SSH keys so users don't have to type _username_ and _password_ every time.\n\nOn Windows, you can use [PuTTYgen.exe](https://www.ssh.com/academy/ssh/putty/windows/puttygen) or [OpenSSH](https://askme4tech.com/how-configure-ssh-key-based-authentication-windows) to _generate_ [SSH keys](https://phoenixnap.com/kb/generate-ssh-key-windows-10). Then [save](https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/create-with-putty/) both the _public key_ and _private key_.\n\n### Link SSH keys with GitHub\n\nFirst, log in to GitHub and click the profile picture in the upper right corner. Then, click _Settings_ in the _drop-down_ menu.\n\nNext, on the left side, click ```SSH and GPG Keys```. Then, click the ```New SSH key``` button in the upper right corner. Give the SSH key something descriptive enough or any name at all. Leave the GitHub Settings window open for the next step.\n\nNow, copy the **SSH public key** that was just saved (Note that the **.pub file extension** is important in this case.)\n\nNow, return to GitHub in the browser window from earlier and _paste_ the copied key into the _key field_. [Keep the key type](https://nishtahir.com/how-to-enable-ssh-key-verification-with-git-and-github/#adding-your-key-to-github) as ```Authentication Key```, then click ```Add SSH key```. Done! The SSH key has been successfully added!\n\n![ssh key settings on GitHub account](pengaturan-kunci-ssh-akun-github.webp)\n\n### Test SSH keys\n\nFollow the instructions in [this GitHub article](https://help.github.com/en/articles/testing-your-ssh-connection) to verify the SSH connection (**Don't forget to remove** ```$``` **when copying code!**). This response can be seen in your terminal: **Hi username! You've successfully authenticated, but GitHub does not provide shell access**. If this message appears, the SSH key was successfully added. If the output doesn't match, try these steps again or [check this reference](https://www.theodinproject.com/lessons/foundations-setting-up-git#step-25-testing-your-key).\n\n## Lessons Learned\n\nGit installation on each OS is quite different, especially Windows which is not equipped with a _Package Manager_. Unlike Ubuntu which has ```apt``` and MacOS with ```brew```.\n\nThere is an article discussing that there is an _asymmetric cryptography_ algorithm that is no longer recommended for _generating_ SSH, because it is considered weak. But it seems I forgot to save the _link_ to that article hehehe. Oh! Just found a similar article, [turns out DSA keys](https://thechief.io/c/news/github-is-making-protocol-security-changes-for-ssh-users/).\n\nThanks to those who stumbled upon this notes section and read it. Hope these notes are useful for you.\n\nThat's all. Regards.\n\n[^1]: [Setting Up Git](https://www.theodinproject.com/lessons/foundations-setting-up-git) by The Odin Project.\n","body_clean":"Introduction #Git is a distributed version control system that is free and open source designed to handle everything from small to very large projects with speed and efficiency.\nMeanwhile, GitHub is a complete developer platform and service for building, scaling, and delivering secure software using Git.\nGit Installation #Git installation for Windows is as follows,\nWindows First download the Git installer at https://git-scm.com/downloads. Then open that installer.\nFollow the next steps. Just click Next, make sure it\u0026rsquo;s on default, then next again. As usual~~\nLinux (Ubuntu) Perform update and upgrade on the system with the following command:\nsudo apt update \u0026amp;\u0026amp; sudo apt upgrade -y Install the Git package:\nsudo add-apt-repository ppa:git-core/ppa sudo apt update sudo apt install Git Verify the Git version and ensure it\u0026rsquo;s at minimum version 2.281\ngit --version MacOS Follow these steps hehehe\nConfigure Git and GitHub #Create a GitHub account #Open GitHub.com and create an account! During account setup, an email address will be requested by Git. And it must be a real email. Because contributions will be identified by default by the email that will be used.\nConcerns about privacy, or simply not wanting your email address to be known publicly, then you can check two boxes on the Email Settings page after logging into GitHub account settings:\nSo, an email like 34987164+fanajib5@users.noreply.github.com will be used for Git configuration.\nSet up Git #For Git to work properly, users must provide information so local Git users can be linked to GitHub. When working in a team, others may see what has been done and who did what on each line of code.\nOn Windows, the built-in Git Bash.exe application can be used for Git configuration.\nThe following command will configure Git. Information inside quotation marks can be replaced with personal information (but keep the quotation marks)!\ngit config --global user.name \u0026#34;BudiTanpoHutang99\u0026#34; git config --global user.email \u0026#34;hutangtanpo@budi.id\u0026#34; If using GitHub private email, the configuration would be:\ngit config --global user.email \u0026#34;071367+BudiTanpoHutang99@users.noreply.github.com\u0026#34; The default branch on new repositories has been changed by GitHub from master to main. So, change the default branch for Git using the command:\ngit config --global init.defaultBranch main Colorful output with git can be enabled with:\ngit config --global color.ui auto The reconciliation behavior of default branch to merging can be set with:\ngit config --global pull.rebase false OK! Let\u0026rsquo;s try verifying the results of the Git configuration that has been done:\ngit config --get user.name git config --get user.email Create SSH keys #SSH keys are cryptographically secure identifiers which are like very long passwords to identify user machines. GitHub uses SSH keys so users don\u0026rsquo;t have to type username and password every time.\nOn Windows, you can use PuTTYgen.exe or OpenSSH to generate SSH keys. Then save both the public key and private key.\nLink SSH keys with GitHub #First, log in to GitHub and click the profile picture in the upper right corner. Then, click Settings in the drop-down menu.\nNext, on the left side, click SSH and GPG Keys. Then, click the New SSH key button in the upper right corner. Give the SSH key something descriptive enough or any name at all. Leave the GitHub Settings window open for the next step.\nNow, copy the SSH public key that was just saved (Note that the .pub file extension is important in this case.)\nNow, return to GitHub in the browser window from earlier and paste the copied key into the key field. Keep the key type as Authentication Key, then click Add SSH key. Done! The SSH key has been successfully added!\nTest SSH keys #Follow the instructions in this GitHub article to verify the SSH connection (Don\u0026rsquo;t forget to remove $ when copying code!). This response can be seen in your terminal: Hi username! You\u0026rsquo;ve successfully authenticated, but GitHub does not provide shell access. If this message appears, the SSH key was successfully added. If the output doesn\u0026rsquo;t match, try these steps again or check this reference.\nLessons Learned #Git installation on each OS is quite different, especially Windows which is not equipped with a Package Manager. Unlike Ubuntu which has apt and MacOS with brew.\nThere is an article discussing that there is an asymmetric cryptography algorithm that is no longer recommended for generating SSH, because it is considered weak. But it seems I forgot to save the link to that article hehehe. Oh! Just found a similar article, turns out DSA keys.\nThanks to those who stumbled upon this notes section and read it. Hope these notes are useful for you.\nThat\u0026rsquo;s all. Regards.\nSetting Up Git by The Odin Project.\u0026#160;\u0026#x21a9;\u0026#xfe0e;\n","canonical":"https://najib.id/en/writing/2023/git-installation-and-configuration/","description":"A complete guide to installing and configuring Git and GitHub: from setting up your account, SSH keys, to best practices for backend developers.","language":"en","lastmod":"2026-11-11T23:31:00Z","publishedAt":"2023-07-31T22:00:01Z","readingTime":4,"section":"writing","series":null,"tags":["notes","git","github"],"title":"Git Notes: installation, configuration, and examples","type":"writing","url":"https://najib.id/en/writing/2023/git-installation-and-configuration/","wordCount":765}
