Skip to content

yididiel7/GitFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitMydocs: Connecting Git to Github

This guide helps you set up and configure Git with GitHub. For video tutorial, see Connecting Git to Github in 8 minutes.

Prerequisites

Ensure you have Git installed on your system.

Initial Setup

1. Create Working Directories

First, create two directories for your GitHub projects:

# Create first directory
mkdir -p directory1

# Navigate into it
cd directory1

# Create second directory for GitHub repo
mkdir -p directory2

2. Initialize Git Repository

Navigate to your project directory and initialize Git:

git init

3. Configure Git Identity

Set your Git username and email:

git config --global user.name "USER_NAME"
git config --global user.email "YOUR-EMAIL.com"

4. Connect to GitHub Repository

# Add remote repository
git remote add origin https://github.com/USER-NAME/repository.git

# Verify remote connection
git remote -v

# Authenticate with personal access token
git remote set-url origin https://USER_NAME:[email protected]/USER-NAME/repository.git

Basic Git Operations

Fetching & Branching

# Fetch all branches and history
git fetch origin

# View commit history
git log

# Switch branches
git switch main

# List branches
git branch

# Pull changes from remote
git pull origin

Making Changes

# Stage all changes
git add .

# Commit changes with message
git commit -m "commit message"

# Push changes to remote repository
git push origin master

# Pull latest changes from remote
git pull origin master

Setting Up Remote Tracking

To automatically set up remote tracking, configure Git globally:

git config --global push.autoSetupRemote true

Or manually set upstream:

git push --set-upstream origin master

Useful Commands

# View repository status
git status

# View commit history
git log

Copyright (C) 2025 by Yididiel Hills All rights reserved [email protected].

About

Showing the flow of Git & Github use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages