Skip to content

Instantly share code, notes, and snippets.

@cole-wilson
Last active February 26, 2021 17:04
Show Gist options
  • Save cole-wilson/ca4c2f0dea7391532ea9b05e9ecb7e85 to your computer and use it in GitHub Desktop.
Save cole-wilson/ca4c2f0dea7391532ea9b05e9ecb7e85 to your computer and use it in GitHub Desktop.
A bash script to upload an existing project to git.
# This is a bash script to upload two folders to GitHub
# just type the lines directly into the terminal
# no need to put them in a file or anything
# You don't need to type anything after the # comment
# Tell git who you are:
git config user.email "<YOUR_EMAIL>"
git config user.name "<YOUR_NAME>"
# Note: include files starting with `.`
# HOME DIRECTORY
cd /home/pi/ # Move into the home directory (just in case you aren't there already)
rm -rf .git/ # Remove git if it's already there MAKE SURE THIS IS TYPED RIGHT!!
git init # Initialize the *local* git repo
git add . # Add all files recursively to local git branch
git commit -m "Initial Commit :rocket:" # Commit files
git remote add origin https://github.com/cole-wilson/orf-inventory.git # Tell git where to push
git push -u origin master # Push to remote repo
# WEB DIRECTORY (different repo)
cd /var/www/html/ # Move into the web directory
rm -rf .git/ # Remove git if it's already there MAKE SURE THIS IS TYPED RIGHT!!
git init # Initialize the *local* git repo
git add . # Add all files recursively to local git branch
git commit -m "Initial Commit :rocket:" # Commit files
git remote add origin https://github.com/cole-wilson/orf-inventory-web.git # Tell git where to push
git push -u origin master # Push to remote repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment