0% found this document useful (0 votes)
2 views

Github Notes

This guide provides step-by-step instructions for uploading a project folder to a remote repository using the command prompt. It covers prerequisites, initializing a Git repository, adding files, committing changes, linking to a remote repository, and pushing code to platforms like GitHub. Additionally, it addresses common issues and offers solutions for troubleshooting during the process.

Uploaded by

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

Github Notes

This guide provides step-by-step instructions for uploading a project folder to a remote repository using the command prompt. It covers prerequisites, initializing a Git repository, adding files, committing changes, linking to a remote repository, and pushing code to platforms like GitHub. Additionally, it addresses common issues and offers solutions for troubleshooting during the process.

Uploaded by

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

Comprehensive Guide: Uploading a Project in a Folder Using

Command Prompt
If you have a project inside a folder and you want to upload (push) it to a remote repository (e.g.,
GitHub, GitLab, or Bitbucket) using the command prompt (cmd in Windows or terminal in
Linux/macOS), follow these steps:

1. Prerequisites
Before proceeding, ensure you have:
✅ Git Installed – Download and install Git.
✅ GitHub (or GitLab, Bitbucket) Account – Create one if you don’t have it.
✅ A Remote Repository – You need a repository on GitHub (or another service).

2. Open Command Prompt and Navigate to Your Project


Folder
1. Open Command Prompt (cmd) or Git Bash.

2. Use the cd command to navigate to your project folder:


cd path\to\your\project-folder

Example:
cd C:\Users\YourUsername\Documents\MyProject

3. Initialize a Git Repository in the Folder


Run the following command inside your project folder to initialize a Git repository:
git init

This will create a hidden .git folder, making the directory a Git repository.

4. Add Files to the Staging Area


To add all files in the project folder to the Git staging area, use:
git add .

🔹 The dot (.) means add all files.

✅ To add a specific file, use:


git add filename.extension

5. Commit the Files


A commit is a snapshot of your project. Create an initial commit with a message:
git commit -m "Initial commit"

6. Add a Remote Repository (GitHub, GitLab, etc.)


For GitHub
1. Go to GitHub and create a new repository (do not initialize with README,
.gitignore, or license).

2. Copy the repository URL (e.g.,


https://github.com/yourusername/myproject.git).

3. Link the local project to the remote repository:


git remote add origin https://github.com/yourusername/myproject.git

🔹 Check if the remote was added successfully:


git remote -v

7. Push Your Code to GitHub


Push your committed files to GitHub using:
git push -u origin main

🔹 If main is not set as the default branch, use:


git push -u origin master

🔹 If this is your first push, Git may ask for authentication:


• HTTPS Method: You’ll need to enter your GitHub username and PAT (Personal Access
Token) instead of a password.
• SSH Method: If you’ve set up SSH keys, authentication happens automatically.
✅ After a successful push, your project is now live on GitHub!

8. Verifying the Upload


1. Go to your GitHub repository URL.
2. Refresh the page, and you should see all your project files.

9. Future Updates: How to Push Changes


After making changes to your project, follow this workflow to upload updates:
git add .
git commit -m "Updated feature XYZ"
git push origin main

10. Cloning the Repository (If Needed)


If you or someone else wants to download the repository, use:
git clone https://github.com/yourusername/myproject.git

Bonus: Handling Common Issues


❌ Issue: fatal: remote origin already exists
✅ Solution: Remove and re-add the remote:
git remote remove origin
git remote add origin https://github.com/yourusername/myproject.git

❌ Issue: fatal: not a git repository


✅ Solution: Run git init again inside the project folder.

🎯 Final Thoughts
By following these steps, you can successfully upload your project folder to a remote repository
using the command prompt. Let me know if you need help with any step! 🚀

You might also like