Node Js - Push your project to GitHub online repository
GitHub: GitHub is an online repository and software development platform where you can push your local git repository changes and make it available for others to access your project code.
GitHub simplifies the process of working with your team members and you can easily collaborate on projects. Team members can work on files and can merge their changes to the GitHub repository.
Before we push out local code to the Github repository, there should be a secure connection between the local system and the Github server using SSH (Secure Shell) Keys.
Create an account on GitHub and then log in to the account
Signup to the GitHub with your email and password. After successful account creation, login to your account.
Create a new Repository on GitHub
We have now created a repository on GitHub. In the next step, we will push our local repository to GitHub.
We will use the second option - "Push an existing repository from the command line".
Steps to push local repository to GitHub:
1. Create a new SSH key on Github
Open the URL on Github: SSH Key on GitHub
Copy the public SSH key (id_rsa.pub) content from your local machine. Use the command to see the content: cat ~/.ssh/id_rsa.pub
Give a title to the Key paste the content of public SSH key from your system
Now, we have added an SSH key on the GitHub account.
Test your SSH connection with GitHub using the command on Gitbash: ssh -T git@github.com
2. Make sure all the changes in the local Git repository are committed. If not, you need to first commit all the changes.
3. Setup a channel with GitHub using the command, Run this in VsCode terminal
git remote add origin https://github.com/Vishalbhardwaj790/NodeTutorial.git
you can copy this command from your Github account.
4. Push commits to Github
git push -u origin master
Now check on Github, whether your code is pushed to Github or not.
0 Comments