Create new repo on github from bash remotely
You can create a new repository on GitHub from a remote Bash shell using the following command:
git init
git add.
git commit -m "Initial commit"
git remote add origin https://github.com/your-username/your-repo-name.git
git push -u origin master
Here's a breakdown of each command:
git init
: Initializes a new Git repository in the current directory.git add.
: Adds all files in the current directory to the Git index.git commit -m "Initial commit"
: Commits the changes with a meaningful commit message.git remote add origin https://github.com/your-username/your-repo-name.git
: Adds a remote repository named "origin" with the URL of your new repository.git push -u origin master
: Pushes the local repository to the remote repository, and sets the upstream tracking information for the "master" branch.
Note:
- Replace
your-username
andyour-repo-name
with your actual GitHub username and repository name. - Make sure you have a GitHub account and have created a new repository with the same name as the one you're trying to create.
- If you're using a private repository, you'll need to authenticate with GitHub using
git config --global user.email "[email protected]"
andgit config --global user.name "Your Name"
before pushing the changes.
Also, you can use gh
command-line tool which is a GitHub CLI tool, you can install it by running curl -fsS -L https://cli.github.com/install.sh | sh
and then you can create a new repository by running gh repo create your-repo-name