PUSHING FOLDERS TO GITHUB USING SSH
Introduction Pushing is the process of uploading a folder saved on a local repository to an online repository which can be accessed remotely. The online repository may be public or private. This article is an explanation of the step by step process of how to push projects from your local folder to GitHub on windows operating system. We shall use GitBash to write command line language and SSH key…
Pushing files to a remote repository on GitHub is the method of transferring a folder stored on a local computer to a shared online space. This shared location can be made accessible to anyone, or it can be set to private. This article provides a detailed walkthrough of the procedure for uploading projects from a local folder to GitHub on a Windows system. The steps involve using GitBash, a command-line interface, and SSH keys to establish a connection between GitHub and GitBash.
Before beginning, it's necessary to have a GitHub account, GitBash installed on the computer, and GitBash configured properly. This can be checked by running the command "git config --global --list". After that, an SSH key needs to be set up. This can be done by opening GitBash and generating a new SSH key with the command "ssh-keygen -t ed25519 -C “email”", where "email" is replaced with the email associated with the GitHub account.
The key's creation can be confirmed with the command "ls -al ~/.ssh", and the public key can be copied from "cat ~/.ssh/id_ed25519.pub".
Next, the SSH key needs to be added to the GitHub account. This is done by navigating to the GitHub account's settings, then selecting "SSH" where a new SSH key can be added. It should be given a title and the copied public key pasted into the designated field.
Once the SSH key is set up, the push process can begin. The current working directory should be confirmed using the command "pwd". The "ls -la" command can then be used to view all files, both hidden and non-hidden. If the correct folder is not visible, the "cd" command can be used to navigate to it.
The local folder needs to be initialized as a Git repository by running "git init". The files can then be staged for tracking with "git add .", and committed with a message describing the changes using "git commit -m “description”". An empty repository must be created on GitHub, with the repository name and "README" unchecked. The connection option should be set to SSH.
The SSH repository address can be copied from GitHub and then pasted into the GitBash command line as "git remote add origin" followed by the pasted address.
To ensure the remote is correct, the command "git remote -v" can be run. The project can now be pushed to the GitHub repository using "git push -u origin main". Finally, refreshing the GitHub repository page will display the pushed folder.
This process outlines the entire workflow of transferring a local project to GitHub using SSH on a Windows system. This cycle will be repeated each time changes are made to the project.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.