-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush-to-github.sh
More file actions
executable file
·35 lines (26 loc) · 890 Bytes
/
Copy pathpush-to-github.sh
File metadata and controls
executable file
·35 lines (26 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/bash
# Script to push code to GitHub
# Usage: ./push-to-github.sh <github-repo-url>
if [ -z "$1" ]; then
echo "❌ Error: Please provide GitHub repository URL"
echo "Usage: ./push-to-github.sh https://github.com/yourusername/pos-js.git"
exit 1
fi
REPO_URL=$1
echo "🚀 Setting up GitHub remote and pushing code..."
echo "Repository URL: $REPO_URL"
# Add remote origin
git remote add origin $REPO_URL 2>/dev/null || git remote set-url origin $REPO_URL
# Check current branch
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
# Push to GitHub
echo "📤 Pushing to GitHub..."
git push -u origin $CURRENT_BRANCH
if [ $? -eq 0 ]; then
echo "✅ Successfully pushed to GitHub!"
echo "🌐 View your repository at: $REPO_URL"
else
echo "❌ Failed to push. Please check your repository URL and permissions."
exit 1
fi