Fundamentals 6 min read

Master Git Basics: Create, Clone, Push, and Pull Repositories

This guide walks you through creating a remote GitHub repository, cloning it locally, and using essential Git commands to add, commit, push, and pull code, plus integrating Git with IntelliJ IDEA, illustrated with step‑by‑step screenshots.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Git Basics: Create, Clone, Push, and Pull Repositories

Git Overview

Create a remote repository

Clone the code

Push and pull related commands

GitHub official site: https://github.com

1. Create a Remote Repository

1.1 Log in to GitHub

1.2 Create a new repository

Log in, click the "+" in the upper right corner, select <strong>New repository</strong>, then fill in the repository name and other options.

1.3 Invite team members

2. Clone the Code

2.1 Choose a project and copy its URL

2.2 Open a command line in the desired local directory (right‑click → Git Bash Here)

2.3 Run the clone command with the repository URL

git clone https://github.com/YuQiangA/Demo.git

3. Push and Pull Commands

git clone <em>remote‑repo‑url</em>          // Clone remote repository
git remote -v                         // Show remote aliases (default: origin)
git remote add <em>alias</em> <em>url</em>    // Add remote alias
git branch -v                         // List branches
git branch <em>branch‑name</em>          // Create branch
git checkout <em>branch‑name</em>       // Switch branch
git push <em>alias</em> <em>branch‑name</em>   // Push to remote
git pull <em>alias</em> <em>branch‑name</em>   // Pull from remote

3.1 Push code

git add <em>filename</em>
git commit -m "summary" <em>filename</em>
git push origin master

3.2 Pull code

git pull origin master

3.3 Other useful commands

git config --global user.name <em>username</em>   // Set user name
git config --global user.email <em>email</em>    // Set user email
git init                                      // Initialize local repo
git status                                    // Show repo status
git log                                       // View commit history
git reset --hard <em>commit‑id</em>            // Reset to specific commit
git merge <em>branch‑name</em>                 // Merge branch into current

IDEA Integration with Git

Specify the Git executable for IDEA

Create a Git repository

Clone, push, and pull within IDEA

To add and commit files, select the files/folders, right‑click, and choose the appropriate Git action.

Switch to a specific version or branch as needed.

Create a new branch and switch to it.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

GitIntelliJ IDEARepositorypushclonepull
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.