[go: up one dir, main page]

0% found this document useful (0 votes)
2 views3 pages

Git Local To Remote Simplified

This document provides a simplified guide on how to create a local Git repository and push it to a remote repository on platforms like GitHub or GitLab. It includes steps for installing Git, configuring user details, creating and adding files, committing changes, and linking the local repository to the remote one. Finally, it explains how to push the local commits to the remote repository and verify the upload on GitHub.

Uploaded by

prasidhsiddu7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Git Local To Remote Simplified

This document provides a simplified guide on how to create a local Git repository and push it to a remote repository on platforms like GitHub or GitLab. It includes steps for installing Git, configuring user details, creating and adding files, committing changes, and linking the local repository to the remote one. Finally, it explains how to push the local commits to the remote repository and verify the upload on GitHub.

Uploaded by

prasidhsiddu7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Git: Create Local Repository and Push to Remote (Simplified)

Step 1: Install Git

Download Git from https://git-scm.com.

After installation, check if it's installed using:

git --version

This checks if Git is installed on your system.

Step 2: Configure Git

Set your name and email:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

These commands tell Git who you are (for commit records).

Step 3: Create a Local Repository

1. Create a folder:

mkdir my-project

cd my-project

Creates a project folder and moves inside it.

2. Initialize Git:

git init

Starts tracking the folder with Git.

Step 4: Create and Add Files

1. Create a new file:

echo "# My Project" > README.md


Git: Create Local Repository and Push to Remote (Simplified)

Creates a README file with text.

2. Add the file to Git:

git add README.md

Tells Git to track this file.

3. Check status:

git status

Shows which files are staged or not.

Step 5: Commit Changes

git commit -m "Initial commit"

Saves your changes to the local repository with a message.

Step 6: Create Remote Repository

Go to https://github.com or GitLab.

Click on New Repository, give it a name (e.g., my-project), and keep it empty (no README).

This creates a remote space to store your project.

Step 7: Connect Local to Remote

1. Copy the repo link (e.g., https://github.com/yourname/my-project.git)

2. Link it to your local project:

git remote add origin <repo-link>

Connects your local repo to the GitHub repo.

3. Verify connection:
Git: Create Local Repository and Push to Remote (Simplified)

git remote -v

Shows the remote repo URL linked.

Step 8: Push to Remote

git push -u origin master

Uploads your local commits to GitHub (use "main" instead of "master" if needed).

Step 9: Verify on GitHub

Go to your GitHub repo page.

You'll see your files and commit.

Confirms that your project is now online.

You might also like