Master Git and GitHub: From History to Hands‑On Setup and Collaboration
This guide explores the origins of Git, the birth of GitHub, and provides step‑by‑step instructions for installing Git on various platforms, configuring user settings, linking local repositories to remote GitHub repos, and collaborating through forks, pull requests, and IDE integration.
Git and GitHub History
Git was created by Linus Torvalds in 2005 as a distributed version‑control system after the community lost access to the commercial BitKeeper tool. Within a month Git took over the Linux kernel source management, and in 2008 GitHub launched to host remote repositories, fostering strong open‑source communities.
Why Use Git and GitHub
Git enables version management, collaborative editing, file‑state tracking, permission control, branch management, and distributed repositories that improve efficiency, safety, and flexibility for developers.
Installing Git
CentOS
sudo yum install git-all
git --versionUbuntu sudo apt-get install git Windows
Download from git-scm.com .
Configure Git
git config --global user.name "guangguang"
git config --global user.email "[email protected]"
git config --global merge.tool "kdiff3"
git config --global core.autocrlf false
# Encode settings
git config --global gui.encoding utf-8
git config --global core.quotePath off
# Windows case handling
git config --global core.ignorecase falseGenerate SSH Key
ssh-keygen -t rsa -C "[email protected]"
ssh-add ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pubCopy the public key to GitHub → Settings → SSH keys.
Link Local Repository to GitHub
git remote add origin https://github.com/qqdb/example01.gitReplace the URL with your repository address.
git push -u origin masterSubsequent pushes use git push origin master. Force push ( git push -f origin master) should be avoided after the first push.
Clone a Repository
Use git clone https://github.com/owner/repo.git in your IDE (e.g., PyCharm) or command line.
Fork and Contribute
Click “Fork” on a GitHub project to create your own copy. Clone the forked repo, make changes, commit, and push. Open a pull request on the original repository, where maintainers can review and merge your changes.
Typical Git Operations in IDE
IDE integration (e.g., PyCharm, IntelliJ IDEA) provides UI for committing, pushing, pulling, branching, and handling merge conflicts, streamlining the workflow described above.
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.
Java Backend Technology
Focus on Java-related technologies: SSM, Spring ecosystem, microservices, MySQL, MyCat, clustering, distributed systems, middleware, Linux, networking, multithreading. Occasionally cover DevOps tools like Jenkins, Nexus, Docker, and ELK. Also share technical insights from time to time, committed to Java full-stack development!
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.
