Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Welcome to your first GitHub repository! This tutorial will guide you through the process of creating and managing a GitHub repository using Git via the command line.

License

Notifications You must be signed in to change notification settings

FNBUBBLES420-ORG/how-to-use-git

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Repository Creation Tutorial (Using Git)

Welcome to your first GitHub repository! This tutorial will guide you through the process of creating and managing a GitHub repository using Git via the command line.

Step 1: Sign Up for GitHub

  1. Visit GitHub: Go to GitHub's website.
  2. Sign Up: Click on "Sign up" in the upper-right corner and follow the instructions to create your account.

Step 2: Setting Up Git

  1. Download Git: Go to Git's website and download the version for your operating system.

  2. Install Git: Follow the installation instructions for your operating system:

    • Windows: Run the installer and follow the prompts.
    • Mac: Run the downloaded .dmg file.
    • Linux: Use your package manager, e.g., sudo apt-get install git for Ubuntu.
  3. Configure Git:

    • Open a terminal or command prompt.
    • Set your username:
      git config --global user.name "Your Name"
    • Set your email:
      git config --global user.email "[email protected]"

Step 3: Creating a New Repository on GitHub

  1. Login to GitHub: Go to GitHub's website and log in.

  2. New Repository:

    • Click on the "+" icon in the upper-right corner.
    • Select "New repository".
  3. Repository Details:

    • Repository Name: Enter a name for your repository.
    • Description: Optionally, enter a description.
    • Public/Private: Choose if you want your repository to be public or private.
    • Initialize Repository: Check the box to initialize the repository with a README.md file.
    • License: Optionally, choose a license.
    • .gitignore: Optionally, select a .gitignore template.
  4. Create Repository: Click "Create repository".

Step 4: Cloning the Repository to Your Local Machine

  1. Copy the Repository URL: On your repository page, click on the green "Code" button and copy the repository URL.
  2. Clone the Repository:
    • Open a terminal or command prompt.
    • Navigate to the directory where you want to clone the repository.
    • Run:
      git clone https://github.com/your-username/your-repo-name.git
    • Replace https://github.com/your-username/your-repo-name.git with your repository URL.

Step 5: Making Changes and Committing

  1. Navigate to the Repository:
    cd your-repo-name
  2. Create or Modify Files:
  • Use your favorite text editor to create or edit files.
  • For example, create a new file hello.txt
    echo "Hello, GitHub!" > hello.txt
    
  1. Stage the Changes:
  • Add files to the staging area:
    git add hello.txt
    
  1. Commit the Changes:
  • Commit the changes with a message:
    git commit -m "Add hello.txt with a welcome message"
    

Step 6: Pushing Changes to GitHub

  1. Push the Changes:
git push origin main
  • This will push your changes to the main branch on GitHub.

Step 7: Creating Branches

  1. Create a Branch:
  • Open a terminal or command prompt.
  • Navigate to your repository directory.
  • Create a new branch:
    git checkout -b new-feature
    
  • Push the new branch:
    git push origin new-feature
    

Step 8: Pull Requests

  1. Open a Pull Request:
  • After pushing your branch, go to your repository page on GitHub.
  • Go to the "Pull requests" tab.
  • Click "New pull request".
  • Select the branches you want to compare.
  • Click "Create pull request" and add details.
  • Click "Create pull request" again to submit.

Step 9: Collaborating with Others

  1. Inviting Collaborators:
  • Go to the "Settings" tab of your repository.
  • Click on "Collaborators" and add collaborators by their GitHub username.
  1. Reviewing Pull Requests:
  • Review and discuss changes proposed by collaborators in pull requests.

Step 10: Creating a Release

  1. Go to Releases: On your repository page, click on the "Releases" tab.
  2. New Release:
  • Click "Draft a new release".
  • Tag Version: Enter a version number for the release (e.g., v1.0.0).
  • Release Title: Enter a title for the release.
  • Description: Provide a description of the release changes.
  • Attach Files: Optionally, attach binary files or other assets.
  • Click "Publish release".

Step 11: Editing Repository Description

  1. Navigate to Your Repository: Go to your repository page.
  2. Edit Description:
  • At the top of the page, click on the settings icon (gear) next to the description.
  • Enter or edit the repository description.
  • Click "Save".

Step 12: Insights and Analytics

  1. Navigate to Insights: Go to the "Insights" tab on your repository page.
  2. View Insights:
  • Here you can view various insights such as traffic, contributions, and more.
  • Explore different sections like "Community", "Code frequency", "Dependency graph", and more for detailed analytics.

Additional Git Commands

Checking the Status of Your Repository

  • View the status of your repository and see which files are staged, unstaged, or untracked:
git status

Viewing Commit History

  • View the commit history of your repository:
git log

Undoing Changes

  • Unstage a file:
git reset HEAD <file>
  • Revert changes in a file:
git checkout -- <file>

Merging Branches

  • Merge a branch into your current branch:
git merge <branch-name>

Deleting Branches

  • Delete a local branch:
git branch -d <branch-name>
  • Delete a remote branch:
git push origin --delete <branch-name>

Troubleshooting Tips

  • If you encounter any issues, consult the Git Documentation or seek help from the GitHub community.
  • Common issues include merge conflicts, which occur when changes in different branches conflict. Follow Git's instructions to resolve conflicts.

Tips for Success

  • Read Documentation: GitHub has extensive Github Documentation that can help with advanced topics.
  • Stay Organized: Keep your commit messages clear and concise.
  • Practice: The more you use Git and GitHub, the more comfortable you'll become.

Additional Resources

About

Welcome to your first GitHub repository! This tutorial will guide you through the process of creating and managing a GitHub repository using Git via the command line.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks