How to add an existing project to GitHub account
Before starting the project make sure you’ve got your GitHub account connected to your local Git. If not, follow the guide to set up Git and GitHub connection.
Github is an excellent service for sharing your projects. It is well suited to collaborate on the project with other developers, as well. This article describes how to upload a project to GitHub:
- Create a new repository in your Github account;
- Fill in name and description fields, then pick either public or private repository;
- In the terminal navigate to your project directory;
- Initialize Git repository with the command (if not initialized):
- Add all files of the project to Git staging:
git add .
- Commit the staged files and add a short commit message:
git commit -m "Implement new feature"
- Copy the remote repository URL on the Quick Setup page of the newly-created repository;
- Add remote URL to the local repository. Remote repository URL defines where changes are pushed:
git remote add origin REPLACE-WITH-YOUR-REPOSITORY-URL
- Push local changes to the remote repository on the GitHub:
git push origin master
Under no circumstances "commit" or "push" sensitive information such as SSH keys, PIN and credit card numbers, passwords, etc.
Now you can share your work or collaborate with your teammates. Your project is available on GitHub.