Master Git in Minutes: From Installation to Remote Repository Management
Learn how to install Git, configure your user identity, create local repositories, add and commit files, generate SSH keys, link to GitHub, push changes, and clone remote projects, all with step‑by‑step commands and screenshots to boost your version‑control efficiency.
Installation
Download Git from https://git-scm.com/download and run the installer (default options). Verify the installation by opening Git Bash.
Configure user identity
Set the global user name and email so that commits are attributed correctly:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"Create a local repository
Choose a directory (for example F:/study/studyGit), create a subfolder for the project, and initialize it with Git:
mkdir learngit
cd learngit
git initThis creates a hidden .git directory that tracks the project.
First commit
Add a file, e.g., readme.txt.
Stage the file: git add readme.txt (or git add . to stage all changes).
Commit with a message:
git commit -m "create readme file"Set up a remote repository
Create an empty repository on GitHub (do not initialize with a README) and copy its URL, for example https://github.com/yourname/learngit.git.
Link local and remote
git remote add origin https://github.com/yourname/learngit.gitPush to remote
git push -u origin masterUsing SSH instead of HTTPS avoids repeated credential prompts.
Configure SSH keys (optional but recommended)
Generate an SSH key pair if one does not exist:
ssh-keygen -t rsa -C "[email protected]"Accept the default prompts, then add the content of id_rsa.pub to GitHub under Settings → SSH and GPG keys → Add SSH key.
Clone a remote repository
Copy the repository URL and run:
git clone https://github.com/yourname/learngit.gitThis creates a learngit directory containing the full commit history.
Typical workflow for subsequent changes
git add .– stage modified files. git commit -m "your message" – record the changes. git push -u origin master – upload to the remote repository.
Key points
Global user.name and user.email apply to all repositories on the machine. git init creates a .git directory that enables version tracking.
Use git remote add origin <url> once; thereafter use git push and git pull for synchronization.
SSH keys provide password‑less authentication; add each machine’s public key to the GitHub account.
Cloning a repository does not require a prior git init because the remote history is copied automatically.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
