Git - First Commit

Prerequisites :- Git is installed on your machine.

Step 1: - Create a repository on GitHub
Step 2: - Create a Folder on your local
Step 3: - Now open a terminal for this directory and hit cmd

git init

Step 4: -Setup your configuration

git config --global user.name "Your Name"
git config --global user.email  Your Email

to see all the config you can type

git config --list

Step 5: Now to connect repository to local folder

git remote add origin "Your repository URL"

you can copy your repository url from github

Step 6: Now you are all connected you can start your work in folder you created to push your code follow below cmds

  • Will show all changes
git status

I will create my new branch and will push our code there

git checkout -b "your branch name"
git add .
git commit -m "First Commit"
git push origin "your branch name"

Done your code is on Git :) :)

24