-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpush_to_github_https.sh
More file actions
34 lines (28 loc) · 862 Bytes
/
Copy pathpush_to_github_https.sh
File metadata and controls
34 lines (28 loc) · 862 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
# Check if git is already initialized
if [ ! -d .git ]; then
echo "Initializing git repository..."
git init
fi
# Add all files
echo "Adding files to git..."
git add .
# Commit changes
echo "Committing changes..."
git commit -m "Update BTC2 implementation - $(date)"
# Check if remote origin exists
if ! git remote | grep -q "origin"; then
echo "Adding remote repository..."
git remote add origin https://github.com/frkrueger/btc2.git
else
# Update remote URL to HTTPS if it's using SSH
current_url=$(git remote get-url origin)
if [[ $current_url == git@* ]]; then
echo "Updating remote URL to HTTPS..."
git remote set-url origin https://github.com/frkrueger/btc2.git
fi
fi
# Push to GitHub
echo "Pushing to GitHub..."
git push -u origin master || git push -u origin main
echo "Repository pushed to GitHub successfully!"