GitHub Account & Creating a Repository
GitHub is a website that hosts Git repositories in the cloud, adding features like issue tracking, pull requests, and team collaboration tools on top of Git. To use it, you first need a free GitHub account.
Once signed up, you can create a new repository directly on GitHub's website, which gives you a URL you can clone or push your local project to.
git remote add origin https://github.com/username/repo.gitCreating an account
Sign up for free at github.com with an email address and username. Verifying your email lets you create repositories and collaborate with others.
Creating a repository
Click 'New repository' on GitHub, give it a name, choose public or private, and optionally add a README. GitHub then shows you commands to connect a local project.
git remote add origin https://github.com/alexsmith/my-project.git
git push -u origin mainBranch 'main' set up to track remote branch 'main' from 'origin'.Connects a local repo to a newly created GitHub repository and pushes the first commits.
git clone https://github.com/alexsmith/my-project.gitCloning into 'my-project'...
remote: Enumerating objects: 10, done.Downloads a full copy of an existing GitHub repository to your machine.
Key points
- GitHub hosts Git repositories in the cloud.
- You need a free GitHub account to create repositories.
- Repositories can be public (visible to everyone) or private.
- GitHub adds features like issues, pull requests, and Actions on top of Git.
