Using Github To Store Scripts

1 minute read


So I’ve been using Google Drive to store my scripts in a “public repo” that I push my sanitized scripts to every so often, but I’ve always wanted to do it the “right way” by sending to Github. Here are the steps I did to do that.

To Resolve:

  1. Download and install Git for Windows and Github Desktop.

  2. Create a repo – This is just a folder I created on Google Drive that is synced that I just call “Github”. It can be any folder with any path.

2b. Copy scripts there.

  1. Then run inside Git Terminal:
cd path\to\githubrepo\reponame

git config --global "gerryw1389"

# confirm

git config --global

# In Github desktop, go to File – Options – Git. Copy the email address

git config --global ""
  1. Now initilize the repo
git init
  1. Add you files
git add --all
  1. Commit your files locally to your computer

From Powershell:

git commit -m 'first commit'
  1. Then pull the latest from Github, should be blank
git pull origin master
  1. Finally push your local changes (commits) up to Github
git push origin master
# or just 'git push'

Using Github Desktop:

  1. When I’m ready to “sync to Github”, I just open my Github desktop application and skip the “fetch origin” tab (4) and just do steps 1-3

Update: Ignore step 4 in the image, you actually do want to ‘fetch origin’. All it does is pull down the latest scripts from github so you can test against your latest commits and make sure they still work before doing a ‘push’.

  1. Then, after selecting “commit to master”, it automatically changes to “push origin”. That is what I push to push my changes to Github.

  1. Then they show in Github. Notice that what you write in Step 1 (from pic in step 2) is what shows up online. Also note, I use the dark theme with Stylish as described in this post.