DEV Community

Cover image for My Journey: Setting Up Git and GitHub
brownian77
brownian77

Posted on

My Journey: Setting Up Git and GitHub

As a developer, establishing a seamless workflow for version control is paramount. One of the essential steps in this process is setting up Git and GitHub using the Ed25519 encryption method. Through trial and error, along with a deep dive into key concepts, I navigated this process and now share my journey with you.

Understanding Git and GitHub:

Before diving into the setup process, it's crucial to grasp the fundamental concepts of Git and GitHub. Git is a distributed version control system that tracks changes in files and enables collaboration among developers. On the other hand, GitHub is a platform that hosts Git repositories and facilitates collaboration through features like pull requests and issues.

Open GitHub Account

1. Visit GitHub's Website:

Open your web browser and navigate to GitHub's website and signup.

1. Install Git:

If Git is not already installed on your system, you can install it using the appropriate package manager for your operating system. Here are the commands for some popular package managers:

  • Ubuntu/Debian:
  sudo apt-get update
  sudo apt-get install git
Enter fullscreen mode Exit fullscreen mode

Generating SSH Keys:

The first step in setting up Git with GitHub using Ed25519 encryption is generating SSH keys. These keys act as a secure means of authentication between your local machine and GitHub. To generate SSH keys with Ed25519 encryption, I utilized the command-line interface and followed GitHub's documentation closely. Here are the commands:

# Generate SSH keys with Ed25519 encryption
ssh-keygen -t ed25519 -C "your_email@example.com"
Enter fullscreen mode Exit fullscreen mode

Adding SSH Keys to GitHub:

With the SSH keys generated, the next step was to add them to my GitHub account. This allows GitHub to recognize and authenticate my local machine when interacting with repositories. Here are the commands:

To display the public key using cat, you can use the following command:

cat ~/.ssh/id_ed25519.pub
Enter fullscreen mode Exit fullscreen mode

This command will output the contents of the public key file (id_ed25519.pub) to the terminal. You can then copy the displayed public key and paste it into your GitHub account settings.

Then, navigate to your GitHub account settings, go to SSH and GPG keys, click on "New SSH key," paste the SSH public key, and save.

Configuring Git:

Configuring Git on my local machine was the next task on my agenda. This involved setting up my user name and email address, which Git uses to attribute commits to a specific user. Additionally, I configured Git to use SSH with Ed25519 encryption as the default protocol for communication with GitHub. Here are the commands:

# Set up Git username and email
git config --global user.name "Your Name"
git config --global user.email "your_email@example.com"

# Set Git to use SSH with Ed25519 for GitHub
git config --global core.sshCommand "ssh -i ~/.ssh/id_ed25519"
Enter fullscreen mode Exit fullscreen mode

Cloning Repositories and Pushing Changes:

With Git and GitHub set up using SSH with Ed25519 encryption, I was ready to start cloning repositories and pushing changes. Here are the commands:

# Clone a repository from GitHub
git clone git@github.com:user/repository.git

# Make changes to files
# Stage changes
git add .

# Commit changes
git commit -m "Your commit message"

# Push changes to GitHub
git push
Enter fullscreen mode Exit fullscreen mode

These actions were performed seamlessly, thanks to the Ed25519 encryption setup.

Why Ed25519 Encryption is Better than Using PAT Token:

Using Ed25519 encryption for SSH authentication offers several advantages over using Personal Access Tokens (PATs). Firstly, SSH keys are considered more secure as they don't require storing sensitive tokens on disk. Secondly, SSH keys provide a seamless authentication experience without the need to repeatedly enter tokens for every interaction. Additionally, SSH keys offer finer-grained access control, allowing users to specify which repositories or actions the keys can access. Overall, Ed25519 encryption provides a more secure, convenient, and flexible authentication method compared to PAT tokens.

Conclusion:

Setting up Git and GitHub using SSH with Ed25519 encryption has streamlined my development workflow and enhanced the security of my interactions with GitHub repositories. By understanding the key concepts and following the setup process meticulously, I've established a robust foundation for version control in my projects. Whether collaborating with a team or working on personal projects, the Ed25519 encryption method for SSH authentication provides peace of mind and efficiency in managing code changes.

As you embark on your journey of setting up Git and GitHub using SSH with Ed25519 encryption, remember to grasp the fundamental concepts, follow documentation carefully, and embrace the learning process. With persistence and attention to detail, you'll establish a seamless workflow that empowers your development endeavors.

Top comments (4)

Collapse
 
jangelodev profile image
João Angelo

Hi brownian77,
Your tips are very useful
Thanks for sharing

Collapse
 
omi profile image
Omi

my commit aren't being 'verified" what i missed?

Collapse
 
ian_teves profile image
Ian Teves

This would've came ein so handy 2 years ago

Collapse
 
hosseinyazdi profile image
Hossein Yazdi

Thanks for sharing! Since you're using Git, you might find this cheatcheet helpful along the way.