5. Storing your repository online
In this tutorial, we will use GitHub to store and manage our repository, and to connect to a web host. If you prefer to use a different online git provider, feel free to do so.
If you are already proficient in git, and have your own preferred workflow, you can create a new GitHub repository for your project using your method of choice. Once you have done so, you can move on to the next page: "Deploy your app to the Web".
Create a repository on GitHub
To create a repository on GitHub, follow these steps:
Go to GitHub.com and log in with your account.
Click the plus icon in the top right corner of the page and select "New repository".
Enter a name for your repository and a brief description (optional).
Choose whether you want your repository to be public or private.
Click "Create repository".
Refer to the GitHub documentation if you want to learn more and see more detailed instructions and options.
Commit your local code to GitHub
After you have created a repository on GitHub, you will need to commit your local code to the repository. This will allow you to store and manage your project's code on GitHub.
To commit your code to GitHub, you will need to use git commands in the terminal. If you are not familiar with git, you can refer to the git documentation or follow these steps:
Navigate to your project directory in the terminal.
Initialize git by running the command
git init -b main
Connect your local repository to the remote repository on GitHub by running the command
git remote add origin <url>, where
<url>is the URL of your GitHub repository.
Add your changes to the staging area by running the command
git add ..
Commit your changes by running the command
git commit -m "Initial commit".
Push your changes to GitHub by running the command
git push -u origin master.
For more detailed instructions and options, you can refer to the GitHub documentation.
See your project on GitHub
To confirm that your project has been successfully stored on GitHub, go to GitHub.com and navigate to your list of repositories. Select the new repository you created, and verify that it contains your project files.