My first GitHub Project; from a local folder to GitHub using Git and SSH
when i first heard about Git and GitHub ,I was really confused by the two terms .more words and concepts such as repository ,commit ,SSH key ,push ,pull, were even more confusing .Knowing the definition alone did not make me understand better .instead of just going through the document provided by my institution i decided to do it practically so that i could learn more on these concepts .this…
My initial encounter with Git and GitHub left me bewildered by terms like repository, commit, SSH key, push, and pull. However, rather than merely reading the provided documentation, I opted to approach this learning process hands-on. This article will explain the practical steps I took on my computer, the procedures involved, and the commands I utilized. It will also elucidate my personal understanding of each phase.
To begin, setting up Git on your computer is essential. Confirm its presence by running "git --version." If it isn't installed, download it from a secure source. Next, set up your identity so Git recognizes you: use "git config --global user.name 'Your Name'" and "git config --global user.email 'your.email@example.com'." These details will be visible in your commit history.
After installing Git locally, proceed to initialize your project. Move to your project directory and type "git init." This creates a hidden .git directory that monitors modifications in your project. The next step is to incorporate your files into the staging area with "git add ." Follow this by committing these changes using "git commit -m 'Initial commit'." Your project is now under version control!
The third step is establishing a connection to GitHub via SSH. SSH (Secure Shell) enables secure connection to GitHub without having to input your password each time. Generate an SSH key with "ssh-keygen -t ed25519 -C 'your.email@example.com'." Copy your public key by using "cat ~/.ssh/id_ed25519.pub." Navigate to GitHub → Settings → SSH and GPG keys → New SSH key, paste the copied public key, and save. Verify the connection by executing "ssh -T git@github.com." If a welcome message appears, your connection is successful!
The fourth step involves creating a remote repository on GitHub. Click on New Repository, name it (for example, "my-first-project"), and decide whether it's public or private. Copy the SSH URL, which typically looks like "git@github.com:username/my-first-project.git." Link your local folder to this remote repository by running "git remote add origin git@github.com:username/my-first-project.git."
Finally, push your code to GitHub. Execute "git push -u origin main" to send your local commits to GitHub. At this point, your project will be accessible online. You can now collaborate, monitor changes, and share your work with others. Understanding the fundamental workflow—initiate, add, commit, and push—is crucial. My first GitHub project marked a significant milestone in my development journey, highlighting the immense value of version control for safeguarding work, fostering learning, collaboration, and growth.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.
This story
This is one outlet's version. Read the fullest account.