How to create Github Repository from command line
In this post I am going to describe creating Repo on Github via Command line
Here is to go:
- Create local folder in your desktop (e.g. Windows)
- Create your code file (s) in this directory
- Install git if you haven’t install it
- start command prompt from start menu and cd to your local folder
- run git init (>git init).
- >git commit -m “Add existing file” to add all your files to local git repo.
- Step 1: Install Git. …
- Step 2: Open a Terminal or Command Prompt. …
- Step 3: Navigate to Your Local Folder, where your local code files exist (or you want to create later)
- Step 4: Initialize a Git Repository, by command >git init
- Step 5: Add Files to the Staging Area, by command >git add .
- Step 6: Commit Changes, by command: >git commit -m ” your commit”
- Step 7: Create a New Repository on GitHub, go to your Github and create a new Repo by pressing to the New button then give a name to your Repo (it is better the name shall be the same folder name in your local folder)
- Step 8: set URL to your Repo on Github by command : > git remote set-url origin https://github.com/yourGithub-id/your-repo (e.g. git remote set-url origin https://github.com/mehzan07/healthcheck)
- Step 9: Branch create your branch on Github by command: >git branch -M main
10.Step 10 Push your files to Github by command: >git push -u origin main
Now you have all local files in the Github, you can Create a ReadMe.md file
Conclusion
In this post we have showed how to create a local git repo and push it to a github Repo by command line.
This post was part of Topics