- Register for a Github account on github.com.
- Remember your Username and Email used.
- Download Git for your appropriate Operating System.
- Go to any project directory or empty directory.
- Click
Shift + Right Click
and procees to click onGit Bash
. - Type in
git config --global user.name "username"
in the terminal that opened, replaceusername
part with your Github Username, click Enter. - Type in
git config --global user.email "uemail"
in the terminal that opened, replaceuemail
part with your Github Email, click Enter.
- ssh-keygen -t rsa -b 4096 -C
"your_email@example.com"
, Replace it with your Github Email, press enter. - Proceed to press Enter Thrice.
- Type in
cat ~/.ssh/id_rsa.pub
in the terminal, press Enter, Copy the result content onto your clipboard. - Go to Github Account Settings, Navigate to
SSH and GPG keys
, or click on this link. - Login to your Github Account if required, and reopen the above link.
- Click on
New SSH Key
on top right of the opened Page. - Enter any title under
Title
Field to remember. - Paste the copied content from Git Bash Terminal into the
Key
Field, ClickAdd SSH Key
.
NOTE :
-
you might have to fork, if you are working on pre-existing project from github.
-
Skip step 1 and step 7 and instead use
git clone git@github.com:username/project.git
,if you are working on pre-existing Github repo that you just forked to download a copy of the project on to your computer. -
you can fork a repo by going to github repo link, clicking the
fork
button on top right of the page, this creates the fork/copy of the repo onto your account, then follow the said steps with this new forked repo from your account. -
To contribute or merge your work on the fork to main repo, go to the main repo's link, click on the
Pull Requests
button next toIssues
button, choose your forked repo branch on the right side, and click onCreate Pull Request
, wait for the owner of the repo to validate your work and merge.
- Open Git Bash Terminal, Type
git init
to make a local git repo. NOTE : Use cd to Change Directory as needed. - Use your fav IDE or Text Editor to work on your code or project as needed in your project directory that you just initialised in Git Bash
- Use
git add -A
to Stage your files, for updating the repo. NOTE :-A
adds all the files in that directory, you can mention individual files with their names as well. - check the status of changed you'll be making soon with
git status
. - Commit all changes made with
git commit -m "Message"
. NOTE : replace Message with anything you want like 'initial commit',or so, this is mandatory. - Now your Local git repo has been updated.
- To update this Local repo into github, go to Github,Click on Repositories under your profile icon, make a new Repo by clicking on the button Top right, Fill in necessary details, and create it.
- Now an SSH link is shown in the form :
git@github.com:username/projectname.git
, copy this link. NOTE : if its not shown, click on the green Code button near the top, click on SSH and copy the shown link. - Now come back to git bash, type in
git remote add origin **Paste link you just copied**
, and press Enter, you just made a remote access to your empty repo on github, and the remote has the alias 'origin'. - use
git push --set-upstream origin main
, where 'origin' is remote, 'main' is the branch. NOTE : you can skip --set-upstream part after the first time, and just use git push. - Now your project files are pushed to repo on Github.
- When working on the project next time use
git pull
to make sure you have the latest copy of the repo, incase others worked on it.