Initial website commit with all files
This commit is contained in:
57
GITHUB-MANUAL-INSTRUCTIONS.md
Normal file
57
GITHUB-MANUAL-INSTRUCTIONS.md
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Manual GitHub Upload Instructions
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
1. Make sure Git is installed on your computer
|
||||||
|
2. Have a GitHub account (username: shaurya05745)
|
||||||
|
3. Create a personal access token on GitHub:
|
||||||
|
- Go to https://github.com/settings/tokens
|
||||||
|
- Click "Generate new token (classic)"
|
||||||
|
- Give it a name like "Website Upload"
|
||||||
|
- Check the "repo" scope box
|
||||||
|
- Click "Generate token"
|
||||||
|
- Copy the token immediately (you won't be able to see it again)
|
||||||
|
|
||||||
|
## Option 1: Run the batch file
|
||||||
|
1. Open the file explorer and navigate to C:\Users\Lenovo\sample-website
|
||||||
|
2. Double-click on "upload-website-to-github.bat"
|
||||||
|
3. Follow the prompts in the terminal
|
||||||
|
4. When asked for your password, enter the personal access token you created
|
||||||
|
|
||||||
|
## Option 2: Manual Git commands
|
||||||
|
If the batch file doesn't work, open a new PowerShell window and run these commands:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
# Navigate to your website folder
|
||||||
|
cd C:\Users\Lenovo\sample-website
|
||||||
|
|
||||||
|
# Initialize Git if not already initialized
|
||||||
|
git init
|
||||||
|
|
||||||
|
# Add all files
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commit the files
|
||||||
|
git commit -m "Upload entire website"
|
||||||
|
|
||||||
|
# Set the remote repository URL
|
||||||
|
git remote set-url origin https://github.com/shaurya05745/website.git
|
||||||
|
# If you get "remote origin not found" error, use this command instead:
|
||||||
|
# git remote add origin https://github.com/shaurya05745/website.git
|
||||||
|
|
||||||
|
# Push to GitHub (you'll be prompted for credentials)
|
||||||
|
git push -u origin master
|
||||||
|
# When prompted for password, use your personal access token, not your GitHub password
|
||||||
|
```
|
||||||
|
|
||||||
|
## Option 3: GitHub Desktop (Easiest)
|
||||||
|
1. Download and install GitHub Desktop from https://desktop.github.com/
|
||||||
|
2. Sign in to your GitHub account
|
||||||
|
3. Add your local repository (File > Add Local Repository...)
|
||||||
|
4. Navigate to C:\Users\Lenovo\sample-website
|
||||||
|
5. Click "Publish repository"
|
||||||
|
6. Enter "website" as the name
|
||||||
|
7. Click "Publish Repository"
|
||||||
|
|
||||||
|
## After uploading
|
||||||
|
1. Visit https://github.com/shaurya05745/website to confirm your files were uploaded
|
||||||
|
2. You can enable GitHub Pages in the repository settings to publish your website
|
||||||
99
Upload-To-GitHub.ps1
Normal file
99
Upload-To-GitHub.ps1
Normal file
@@ -0,0 +1,99 @@
|
|||||||
|
function Push-To-GitHub {
|
||||||
|
param (
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$GitHubRepo,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$true)]
|
||||||
|
[string]$Username,
|
||||||
|
|
||||||
|
[Parameter(Mandatory=$false)]
|
||||||
|
[string]$Token
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check if Git is installed
|
||||||
|
try {
|
||||||
|
$gitVersion = git --version
|
||||||
|
Write-Host "Git is available: $gitVersion" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Git is not installed or not in PATH. Please install Git first." -ForegroundColor Red
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if repository exists
|
||||||
|
if (-not (Test-Path -Path ".git")) {
|
||||||
|
Write-Host "Initializing git repository..." -ForegroundColor Yellow
|
||||||
|
git init
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Git repository already initialized." -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
# Configure remote
|
||||||
|
$remoteUrl = "https://$Username@github.com/$GitHubRepo"
|
||||||
|
if ($Token) {
|
||||||
|
$remoteUrl = "https://$Username:$Token@github.com/$GitHubRepo"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if origin exists
|
||||||
|
$remotes = git remote
|
||||||
|
if ($remotes -contains "origin") {
|
||||||
|
Write-Host "Updating remote URL..." -ForegroundColor Yellow
|
||||||
|
git remote set-url origin $remoteUrl
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Adding remote..." -ForegroundColor Yellow
|
||||||
|
git remote add origin $remoteUrl
|
||||||
|
}
|
||||||
|
|
||||||
|
# Add all files
|
||||||
|
Write-Host "Adding all files..." -ForegroundColor Yellow
|
||||||
|
git add .
|
||||||
|
|
||||||
|
# Commit changes
|
||||||
|
Write-Host "Committing changes..." -ForegroundColor Yellow
|
||||||
|
git commit -m "Upload entire website"
|
||||||
|
|
||||||
|
# Get current branch name
|
||||||
|
$branch = git rev-parse --abbrev-ref HEAD
|
||||||
|
Write-Host "Current branch: $branch" -ForegroundColor Green
|
||||||
|
|
||||||
|
# Push to GitHub
|
||||||
|
try {
|
||||||
|
Write-Host "Pushing to GitHub... This might take a while depending on your file size and internet connection." -ForegroundColor Yellow
|
||||||
|
if ($Token) {
|
||||||
|
git push -u origin $branch
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
# Push and capture output to avoid showing credentials in the terminal
|
||||||
|
$output = git push -u origin $branch 2>&1
|
||||||
|
if ($LASTEXITCODE -ne 0) {
|
||||||
|
Write-Host "Push failed. You might need to provide a token." -ForegroundColor Red
|
||||||
|
Write-Host "Visit https://github.com/settings/tokens to create a token with 'repo' scope."
|
||||||
|
$Token = Read-Host "Enter your GitHub Personal Access Token" -AsSecureString
|
||||||
|
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Token)
|
||||||
|
$plainToken = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
|
||||||
|
|
||||||
|
$tokenUrl = "https://$Username:$plainToken@github.com/$GitHubRepo"
|
||||||
|
git remote set-url origin $tokenUrl
|
||||||
|
git push -u origin $branch
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($LASTEXITCODE -eq 0) {
|
||||||
|
Write-Host "Successfully pushed to GitHub!" -ForegroundColor Green
|
||||||
|
Write-Host "Visit https://github.com/$GitHubRepo to see your repository."
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Error pushing to GitHub: $_" -ForegroundColor Red
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Run the function
|
||||||
|
Write-Host "GitHub Website Uploader" -ForegroundColor Cyan
|
||||||
|
Write-Host "======================" -ForegroundColor Cyan
|
||||||
|
$repo = Read-Host "GitHub Repository (e.g., shaurya05745/website)"
|
||||||
|
$username = Read-Host "GitHub Username"
|
||||||
|
|
||||||
|
Push-To-GitHub -GitHubRepo $repo -Username $username
|
||||||
35
github-upload-instructions.md
Normal file
35
github-upload-instructions.md
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# GitHub Upload Instructions
|
||||||
|
|
||||||
|
To upload your website to GitHub:
|
||||||
|
|
||||||
|
## Option 1: Using GitHub Desktop (Easiest)
|
||||||
|
1. Download and install GitHub Desktop from https://desktop.github.com/
|
||||||
|
2. Sign in to your GitHub account
|
||||||
|
3. Add your local repository (File > Add Local Repository...)
|
||||||
|
4. Navigate to C:\Users\Lenovo\sample-website
|
||||||
|
5. Publish the repository to GitHub
|
||||||
|
6. Select your account and the repository name "website"
|
||||||
|
7. Click "Publish Repository"
|
||||||
|
|
||||||
|
## Option 2: Using Git with Personal Access Token
|
||||||
|
1. Go to GitHub: https://github.com/settings/tokens
|
||||||
|
2. Generate a new personal access token with 'repo' scope
|
||||||
|
3. Copy the token
|
||||||
|
4. Open a new PowerShell window and run:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd C:\Users\Lenovo\sample-website
|
||||||
|
git remote set-url origin https://shaurya05745:YOUR_TOKEN@github.com/shaurya05745/website.git
|
||||||
|
git push -u origin master
|
||||||
|
```
|
||||||
|
(Replace YOUR_TOKEN with the token you copied)
|
||||||
|
|
||||||
|
## Option 3: Visual Studio Code
|
||||||
|
1. Open VS Code
|
||||||
|
2. Install the GitHub Pull Requests and Issues extension
|
||||||
|
3. Open your project folder
|
||||||
|
4. Go to Source Control tab
|
||||||
|
5. Sign in to GitHub
|
||||||
|
6. Publish the repository
|
||||||
|
|
||||||
|
Choose the method that works best for you!
|
||||||
18
push-to-github.bat
Normal file
18
push-to-github.bat
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@echo off
|
||||||
|
echo Pushing code to GitHub...
|
||||||
|
|
||||||
|
git add .
|
||||||
|
git commit -m "Full website upload"
|
||||||
|
git push -u origin master
|
||||||
|
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
echo Failed to push to GitHub. You may need to enter credentials.
|
||||||
|
echo Please go to https://github.com/settings/tokens and create a Personal Access Token.
|
||||||
|
echo For password, use the token instead of your GitHub password.
|
||||||
|
set /p token="Enter your GitHub Personal Access Token: "
|
||||||
|
git remote set-url origin https://shaurya05745:%token%@github.com/shaurya05745/website.git
|
||||||
|
git push -u origin master
|
||||||
|
)
|
||||||
|
|
||||||
|
echo Process completed.
|
||||||
|
pause
|
||||||
45
upload-website-to-github.bat
Normal file
45
upload-website-to-github.bat
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
@echo off
|
||||||
|
echo GitHub Website Uploader
|
||||||
|
echo =======================
|
||||||
|
|
||||||
|
REM Check if Git is available
|
||||||
|
git --version
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
echo Git is not installed or not in PATH. Please install Git first.
|
||||||
|
pause
|
||||||
|
exit /b
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Set GitHub details
|
||||||
|
set GITHUB_REPO=shaurya05745/website
|
||||||
|
|
||||||
|
REM Make sure Git is initialized
|
||||||
|
if not exist .git (
|
||||||
|
echo Initializing git repository...
|
||||||
|
git init
|
||||||
|
) else (
|
||||||
|
echo Git repository already initialized.
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Add all files
|
||||||
|
echo Adding all files...
|
||||||
|
git add .
|
||||||
|
|
||||||
|
REM Commit changes
|
||||||
|
echo Committing changes...
|
||||||
|
git commit -m "Upload entire website"
|
||||||
|
|
||||||
|
REM Configure remote
|
||||||
|
echo Setting up remote repository URL...
|
||||||
|
git remote set-url origin https://github.com/%GITHUB_REPO%.git
|
||||||
|
if %errorlevel% neq 0 (
|
||||||
|
git remote add origin https://github.com/%GITHUB_REPO%.git
|
||||||
|
)
|
||||||
|
|
||||||
|
REM Push to GitHub
|
||||||
|
echo Pushing to GitHub... This may prompt for your GitHub credentials.
|
||||||
|
echo For password, use a Personal Access Token (not your GitHub password).
|
||||||
|
echo Visit https://github.com/settings/tokens to create a token with 'repo' scope.
|
||||||
|
git push -u origin master
|
||||||
|
|
||||||
|
pause
|
||||||
Reference in New Issue
Block a user