Curriculum
Course: Git
Login
Text lesson

GitHub Getting Started

GitHub Account

Visit GitHub and create an account.

Get started git

Note: Make sure to use the same email address that you configured in Git.

Create a Repository on GitHub

Now that you have a GitHub account, sign in and create a new repository.

image git 2

And provide the necessary details:

created git 1

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.”

Push Local Repository to GitHub

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:

Example

[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.

Example

[user@localhost] $

git push --set-upstream origin master
Enumerating objects: 22, done.
Counting objects: 100% (22/22), done.
Delta compression using up to 16 threads
Compressing objects: 100% (22/22), done.
Writing objects: 100% (22/22), 92.96 KiB | 23.24 MiB/s, done.
Total 22 (delta 11), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (11/11), done.
To https://github.com/code7schools-test/hello-world.git
* [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
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.