To create a new repository on GitHub and push content to it from the command line, you will need to have Git installed on your computer. You can check if you already have Git installed by running the following command in your terminal:

1
git --version

If you don’t have Git installed, you can download it from the Git website.

To create a new repository on GitHub, follow these steps:

  1. Go to the GitHub website and log in to your account.
  2. Click the “New repository” button on the dashboard.
  3. Give your repository a name and a description, then click the “Create repository” button.
  4. Make note of the repository’s URL, which should be in the format https://github.com/USERNAME/REPOSITORY_NAME.git

To push content to your new repository from the command line, follow these steps:

  1. Open a terminal and navigate to the local directory where you want to store the repository.
  2. Run the following command to initialize a new Git repository:
1
git init
  1. Run the following command to add all of the files in the current directory to the repository:
1
git add .
  1. Run the following command to commit the files to the repository with a message:
1
git commit -m "Initial commit"
  1. Run the following command to add the remote repository as an origin for the local repository:
1
git remote add origin https://github.com/USERNAME/REPOSITORY_NAME.git
  1. Run the following command to push the local commits to the remote repository:
1
git push -u origin master

Your new repository should now be created on GitHub, and the files from your local repository should be pushed to it.