GitHub is a cloud-based platform for version control and collaboration using Git. It helps developers manage code, track changes, and work together on projects.
To start with this tutorial make sure you have install git from this url https://git-scm.com/downloads. Install it like a game. (Just next next next...)
This will install git bash on your windows machine. Then Continue..
To initialize a local Git repository, navigate to the project folder in the command line (git bash) , and run.
git init
This will create a hidden .git directory, signifying the start of a Git repository, even if the folder is initially empty.
git config --local user.name "Your Name"
git config --local user.email "your_email@example.com"
Once you've initialized your Git repository, to make a snapshot you have to stage the changes by using this command.
git add . #this is stage all untracked file
After staging all change to make a checkpoint you can make a meaning full commit to make the changes permanent.
git commit -m "Your commit message"
#example git commit -m "first commit"
When you create a remote repository you next step should be connect you repository with you local machine.
git branch M main #this rename the branch name into main
git remote add <remote_name> git@github.com:<your_github_user_name>/<your_repository_name>.git
#exmple git remote add origin git@github.com:PallabDev/git_repo_1.git
This step is very important to do, otherwise you can't push you private repository to github.
To do so run this commands one by one: ( Make sure you run all this command in Git Bash Terminal )
ssh-keygen -t ed25519 #remember it will ask for a path. remember that path
# press enter to choose default location.
# To Copy the SSH key go to the path using git bash or any command line
# open the id_ed25519.pub file which you have created now.
cat id_ed25519.pub
git push -u origin master
git branch <branch_name> #create new branch
git checkout <branch_name> #switch to new branch
rm -rf .git
We will update this blog soon to include version control-related commands as well. Stay Tune ✔️