Create a local repository and connect with remote repository # 05

Create a git repository on the GitHub website → after that go to PC and follow the steps below …

Create a folder → open the folder → right-click the mouse → click on “Open in Terminal” or “Git Bash Here” → Type echo “README.md file created” >> README.md → press enter… 


Type git init → type git add README.md  → type git commit -m “README.md file has been created” → type git branch -M main → type git remote add origin git@github.com:Mozahedul/gitRepositoryName → type git push -u origin main…


create some files like…

index.html

style.css

info.txt

etc...

Check the unstaged or untracked file with the command like…

git status → press enter 


Track or staged the file, type the command like…

git add . or git add --all → press enter 


Commit the files, type the command like…

git commit -m “commit message” → press enter

git push


Create a connection between the local repository and the remote repository

We can create a connection between the local repository and remote repository in two ways. 


1. With https:

Connect local repository with a remote repository with https:

Login GitHub account and create a new repository → After creating a repository, open it → go to …or push an existing repository from the command line

Copy the code from the clipboard (click on the image-like icon on the right side) 


Now paste into Git Bash Terminal → Press enter → a GitHub window will open → give GitHub username and password → press enter

Now refresh the GitHub repository page → you will see that your local repository files will show here 


2. With SSH key:

Follow the link below...

Generating SSH key:

Visit Now


Adding a new SSH key to your GitHub account:

Visit Now


Testing SSH connection:

Visit Now



Post a Comment

Previous Post Next Post