Creating Github repo from either remote or locally.
Two ways of creating a GitHub repository
There are two ways to create a Github repository. One is pushing from local to remote, another is pulling from remote to local.
Create a repo on Github and Clone it to local
- Create a repo on Github
- Go to the project, find a URL
- Go to your local folder, run command
git clone URL
Create a local repository, push it to your Github account
- Create a directory to contain the project, go into this directory
git initto initialise it as a Git Repository
- You’ll probably want to create a
git add .and
git commit -m ""
- Go to your Github page, create a new repository, select Push an existing repository, get your repo address
- In your local, run
git remote add origin https://github.com/username/new_repo
- Push your code:
git push origin YOUR_BRANCH