Visit GitHub and create an account.
Note: Make sure to use the same email address that you configured in Git. |
Now that you have a GitHub account, sign in and create a new repository.
And provide the necessary details:
We’ll cover the different options and their meanings later. For now, select Public if you want the repository to be visible to everyone, or Private if you prefer to control who can view it. Either way, you’ll have the option to manage who can contribute to the repository.
Then click “Create repository.”
Since we’ve already set up a local Git repository, we’ll now push it to GitHub.
Copy the URL or click the clipboard icon shown in the image above.
Then paste it into the following command:
[user@localhost] $ |
git remote add origin https://github.com/code7schools-test/hello-world.git |
The command git remote add origin URL specifies that you are adding a remote repository with the given URL as the origin for your local Git repository.
Next, we’ll push our master branch to the origin URL and set it as the default remote branch.
[user@localhost] $ |
git push --set-upstream origin master |
Note: As this is your first time connecting to GitHub, you will receive a prompt to authenticate the connection. |
Now, return to GitHub and verify that the repository has been updated.