Author : MD TAREQ HASSAN | Updated : 2023/02/18
Create Repository
Remote repository (in your Github account)
- Click on “+” icon (top right corner) > New Repository
- Enter repository a name
- Enter rerepository description
- Select private (or public)
- You can add README,
.gitignore
and License - Click “Create repository” button
Local repository (your personal PC or company’s PC)
- Create a folder named “git-repositories” in other than desktop or “
C:
” drive - Go to “git-repositories” and create a folder name “
<remote repo name>
” (i.e. “demo-repo1”) - Go to that folder (i.e. “demo-repo1”)
- Right click
- Git bash here
Now execute following commands:
# Create local repository:
git init
# Now add files if you want
# Check status:
git status
# Staging:
git add .
# Check status:
git status
# Commit changes:
git commit --message "<message here>"
Link to Remote Repository
Copy and note down ssh url of the remote repository. Now execute following commands:
git remote add origin <repository ssh url>
git branch -M main
git push -u origin main
Clone Repository
Copy remote repository url (ssh url)
Now
- Go to “git-repositories” folder (i.e., “
F:\git-repositories
”) - Right click > Git Bash Here
- Execute
git clone
command (shown below)
git clone <repository ssh url>
# example: git clone git@github.com:hovermind/demo-repo3.git