-
Notifications
You must be signed in to change notification settings - Fork 132
Enhance GitHub Introduction with Troubleshooting and Practical Examples #1069
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
b4b3330
99f937c
4d1b7c0
291c637
039c3ab
d2f9c3a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,6 +94,66 @@ The fork is a personal copy of the repo which is already present or uploaded in | |
|
|
||
| ::: | ||
|
|
||
| ## Troubleshooting & Common Issues | ||
|
|
||
| Beginner GitHub users often run into similar problems when setting up or contributing. Here are some common issues and their solutions: | ||
|
|
||
| :::info | ||
|
|
||
| ### 1. Git Command Not Working | ||
| - **Problem:** Running Git commands like `git status` or `git commit` throws an error. | ||
| - **Fix:** Make sure Git is installed on your machine by running `git --version` in the terminal. If it’s not installed, [download Git](https://git-scm.com/). | ||
| - If installed but commands still fail, try restarting your terminal or reinstalling Git. | ||
|
|
||
| ### 2. Cannot Push to Repository | ||
| - **Problem:** Errors such as “Permission denied” or “Authentication failed” when using `git push`. | ||
| - **Fix:** Set up your Git global configuration: | ||
| git config --global user.name "Your Name" | ||
| git config --global user.email "[email protected]" | ||
| - Use a Personal Access Token instead of a password for GitHub authentication. Learn how to [set up a token here](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). | ||
| - Confirm you’re pushing to the right repo: | ||
|
|
||
| ### 3. Merge Conflicts | ||
| - **Problem:** Cannot merge branches; get conflict notifications. | ||
| - **Fix:** Open the files listed by Git, edit them to keep only the correct code, and then mark them as resolved: | ||
| git add <file> | ||
| git commit | ||
| - Detailed steps: [Resolving merge conflicts](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts). | ||
|
|
||
| ### 4. Cannot Install Dependencies | ||
| - **Problem:** Running `npm install` fails due to missing modules or permission errors. | ||
| - **Fix:** Try deleting the existing dependencies and reinstalling: | ||
| rm -rf node_modules | ||
| npm install | ||
|
|
||
| ::: | ||
|
|
||
| _For more troubleshooting tips, see the [Beginner Git Guide](https://rogerdudler.github.io/git-guide/) or [GitHub Troubleshooting Docs](https://docs.github.com/en/contributing/setting-up-your-environment-to-work-on-github-docs/troubleshooting-your-environment)._ | ||
|
|
||
| --- | ||
|
|
||
| ## Real-World Use Cases & Examples | ||
|
|
||
| Seeing how GitHub is used in genuine projects makes concepts easier to grasp: | ||
|
|
||
| :::info | ||
| ### Example 1: Team Collaboration Workflow | ||
| Suppose a team is building an e-commerce platform: | ||
| - Developer 1 codes the men’s section on a separate branch. | ||
| - Developer 2 creates the women’s section in another branch. | ||
| - Developer 3 works on the login feature in a third branch. | ||
| - All changes are pushed to their respective branches, reviewed as pull requests, and merged into the main branch once approved. | ||
|
|
||
| ### Example 2: Issue Tracking | ||
| - A user spots a bug, opens a GitHub Issue describing the problem. | ||
| - Maintainer labels the issue (“bug”, “good first issue”), assigns it, and links any related pull requests. | ||
| - Once a fix is merged, the issue auto-closes, keeping project history clear. | ||
|
|
||
| ### Example 3: Open Source Contributions | ||
| - A contributor finds a typo in the documentation. | ||
| - They fork the repo, fix the typo, and open a pull request. | ||
| - Maintainers review and merge, improving the docs for everyone. | ||
| ::: | ||
|
|
||
|
|
||
| ### Watch the video Tutorial | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,98 @@ | ||||||
| --- | ||||||
| id: setup-nodejs | ||||||
| title: Setting Up Node.js for Local Development | ||||||
| sidebar_label: Node.js Setup | ||||||
| description: A beginner's guide to installing and configuring Node.js on your local machine. | ||||||
| slug: /NodeJS-Setup | ||||||
| --- | ||||||
|
|
||||||
| # Setting Up Node.js for Local Development | ||||||
|
|
||||||
| ## Introduction | ||||||
| Node.js is a powerful JavaScript runtime that allows you to run JavaScript code outside of a web browser. It's essential for building modern web applications, APIs, and tools. In this tutorial, we'll walk through the steps to set up Node.js on your local machine. By the end, you'll have a working environment ready for development. | ||||||
|
|
||||||
| This guide is aimed at beginners, so we'll cover everything from installation to verification. If you're new to programming, don't worry—we'll keep it simple! | ||||||
|
|
||||||
| ## Prerequisites | ||||||
| Before we begin, make sure you have: | ||||||
| - A computer with internet access (Windows, macOS, or Linux). | ||||||
| - Administrative privileges on your machine (to install software). | ||||||
| - A code editor like VS Code (optional but recommended for writing code). | ||||||
|
|
||||||
| Estimated time: 10-15 minutes. | ||||||
|
|
||||||
| ## Step-by-Step Guide | ||||||
|
|
||||||
| ### Step 1: Download Node.js | ||||||
| 1. Go to the official Node.js website at [nodejs.org](https://nodejs.org). | ||||||
| 2. On the homepage, you'll see two versions: LTS (Long Term Support, recommended for stability) and Current (for the latest features). | ||||||
| - For beginners, choose the LTS version. | ||||||
| 3. Click on the "LTS" download button. This will automatically detect your operating system and provide the correct installer. | ||||||
|
|
||||||
| ### Step 2: Install Node.js | ||||||
| The installation process varies slightly by operating system. Follow the instructions for your OS: | ||||||
|
|
||||||
| - **Windows**: | ||||||
| 1. Run the downloaded installer (e.g., `node-vXX.XX.X-x64.msi`). | ||||||
| 2. Follow the wizard: Accept the license, choose the default installation options, and click "Install." | ||||||
| 3. Once complete, click "Finish." | ||||||
|
|
||||||
| - **macOS**: | ||||||
| 1. Open the downloaded `.pkg` file. | ||||||
| 2. Follow the installer prompts: Agree to the license and click "Continue" through the steps. | ||||||
| 3. Enter your administrator password if prompted. | ||||||
| 4. After installation, open a terminal to verify. | ||||||
|
|
||||||
| - **Linux (e.g., Ubuntu)**: | ||||||
| 1. Download the installer or use the package manager. For Ubuntu, open a terminal and run: | ||||||
| ``` | ||||||
| curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash - | ||||||
| sudo apt-get install -y nodejs | ||||||
| ``` | ||||||
| 2. If you downloaded the installer, extract it and follow the on-screen instructions. | ||||||
| ### Step 3: Verify the Installation | ||||||
| After installation, let's check if Node.js is working correctly: | ||||||
| 1. Open your terminal or command prompt. | ||||||
| 2. Type the following command and press Enter: | ||||||
| node -v | ||||||
| - This should display the version of Node.js, e.g., `v18.12.1`. | ||||||
| 3. Next, check if npm (Node Package Manager) is installed: | ||||||
| npm -v | ||||||
| - This should show a version like `8.19.2`. npm is used to install packages and dependencies. | ||||||
| If you see the versions printed, congratulations—Node.js is set up successfully! | ||||||
| ### Step 4: Set Up a Simple Project (Optional Hands-On) | ||||||
| To make this more practical, let's create a simple "Hello World" project: | ||||||
| 1. In your terminal, create a new directory: | ||||||
| mkdir my-first-node-project cd my-first-node-project | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Two shell commands are incorrectly combined on a single line without proper separation. A beginner following this tutorial will get an error when trying to execute this command. View DetailsAnalysisShell commands incorrectly combined without separator in Node.js setup tutorialWhat fails: Line 74 in docs/NodeJS-Setup/index.md contains How to reproduce: mkdir my-first-node-project cd my-first-node-projectResult: Creates directories named "my-first-node-project" and "cd" instead of creating directory and changing into it. Shell interprets Expected: Should create directory and then change into it. Fixed by adding |
||||||
| 2. Create a new file called `app.js` using your code editor: | ||||||
| echo 'console.log("Hello, Node.js!");' > app.js | ||||||
| 3. Run the file with Node.js: | ||||||
| node app.js | ||||||
| 4. You should see: `Hello, Node.js!` printed in the terminal. | ||||||
| ## Troubleshooting Common Issues | ||||||
| - **Error: 'node' is not recognized**: Ensure Node.js was added to your system's PATH during installation. Restart your terminal or computer and try again. | ||||||
| - **Permission errors on macOS/Linux**: If you encounter issues, try running commands with `sudo`, but be cautious. | ||||||
| - **Version mismatches**: If the versions don't match, double-check the installation or reinstall from the official site. | ||||||
| For more help, refer to the [official Node.js documentation](https://nodejs.org/en/docs/). | ||||||
| ## Conclusion | ||||||
| You've now set up a local development environment with Node.js! This is your first step toward building web applications, experimenting with frameworks like React, or contributing to projects like Recode Hive. Once you're comfortable, try creating a simple web server or exploring npm packages. | ||||||
| If you found this tutorial helpful, consider sharing your experience in the Recode Hive community. Happy coding! 🚀 | ||||||
| --- | ||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||
| // src/components/tutorialCompletion.tsx | ||||||
| import React, { useState } from 'react'; | ||||||
| import { triggerConfetti } from './ConfettiUtils'; // Import from the separate confetti utility | ||||||
|
||||||
| import { triggerConfetti } from './ConfettiUtils'; // Import from the separate confetti utility | |
| import { triggerConfetti } from '../utils/ConfettiUtils'; // Import from the separate confetti utility |
The import path for ConfettiUtils is incorrect - it's in the utils directory, not the components directory, which will cause a module resolution error at runtime.
View Details
Analysis
Incorrect import path causes module resolution error in TutorialCompletion component
What fails: TutorialCompletion component imports triggerConfetti from './ConfettiUtils' but ConfettiUtils.tsx is located in src/utils/, not src/components/
How to reproduce:
npm run buildResult: Build fails with error: Module not found: Error: Can't resolve './ConfettiUtils' in '/vercel/sandbox/sandpits/kind-crow/src/components'
Expected: Import should resolve correctly to src/utils/ConfettiUtils.tsx using relative path '../utils/ConfettiUtils'
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import TutorialCompletion from '../components/tutorialCompletion'; | ||
|
|
||
| const TutorialPage = () => ( | ||
| <div> | ||
| <h1>My Tutorial</h1> | ||
| {/* Tutorial content here */} | ||
| <TutorialCompletion tutorialTitle="Git Basics" onComplete={() => console.log('Tutorial done!')} /> | ||
| </div> | ||
| ); | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| // src/components/ConfettiUtils.tsx | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file path comment is incorrect - the file is in View Details📝 Patch Detailsdiff --git a/src/components/tutorialCompletion.tsx b/src/components/tutorialCompletion.tsx
index 8d5f57c..3c146ae 100644
--- a/src/components/tutorialCompletion.tsx
+++ b/src/components/tutorialCompletion.tsx
@@ -1,6 +1,6 @@
// src/components/tutorialCompletion.tsx
import React, { useState } from 'react';
-import { triggerConfetti } from './ConfettiUtils'; // Import from the separate confetti utility
+import { triggerConfetti } from '../utils/ConfettiUtils'; // Import from the separate confetti utility
interface TutorialCompletionProps {
tutorialTitle?: string; // Optional prop for the tutorial name
diff --git a/src/utils/ConfettiUtils.tsx b/src/utils/ConfettiUtils.tsx
index 5088a36..a32a92e 100644
--- a/src/utils/ConfettiUtils.tsx
+++ b/src/utils/ConfettiUtils.tsx
@@ -1,4 +1,4 @@
-// src/components/ConfettiUtils.tsx
+// src/utils/ConfettiUtils.tsx
import confetti from 'canvas-confetti';
/**
AnalysisIncorrect file path comment in ConfettiUtils.tsxWhat fails: File comment in How to reproduce: Check line 1 of Result: Comment shows Expected: Comment should accurately reflect actual file path as Additional context: This incorrect comment contributed to the wrong import path |
||
| import confetti from 'canvas-confetti'; | ||
|
|
||
| /** | ||
| * Triggers a celebratory confetti effect. | ||
| * Can be used for achievements, completions, or interactions. | ||
| */ | ||
| export const triggerConfetti = () => { | ||
| confetti({ | ||
| particleCount: 100, // Number of particles (adjust for intensity) | ||
| spread: 70, // Spread angle in degrees | ||
| origin: { y: 0.6 }, // Start position (center-ish screen) | ||
| colors: ['#2563eb', '#7c3aed', '#10b981'], // Custom colors (blue, purple, green – match leaderboard/theme) | ||
| duration: 2000, // Optional: How long it lasts (in ms) | ||
| }); | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete bullet point: "Confirm you're pushing to the right repo:" has no guidance following it, leaving the troubleshooting solution unfinished.
View Details
Analysis
Incomplete troubleshooting bullet point in GitHub documentation
What fails: Line 114 in docs/GitHub/intro-github.md contains incomplete guidance: "Confirm you're pushing to the right repo:" with no actionable instructions
How to reproduce:
Result: Users are left without actionable steps to verify their repository configuration
Expected: Bullet points in troubleshooting sections should provide complete, actionable guidance per the established pattern in the same document
Fix: Added the standard GitHub-recommended command: "Check your remote URL with
git remote -vand ensure it matches the correct repository" as documented in GitHub's official remote management guide