DEV Community

Cover image for Git - First Commit
Prathamesh Patil
Prathamesh Patil

Posted on • Updated on

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
Enter fullscreen mode Exit fullscreen mode

Step 4: -Setup your configuration

git config --global user.name "Your Name"
git config --global user.email  Your Email
Enter fullscreen mode Exit fullscreen mode

to see all the config you can type

git config --list
Enter fullscreen mode Exit fullscreen mode

Step 5: Now to connect repository to local folder

git remote add origin "Your repository URL"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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"
Enter fullscreen mode Exit fullscreen mode

Done your code is on Git :) :)

Top comments (0)