title: Bad Credentials for Github API
body: <p>I have the following script, which I am trying to test out in bash, using curl to do a couple things, one is to create a new repo, the second - which is not implemented yet - is to get the git_url from the json thats returned, which I'm not sure if my <code>parse_json</code> function will let me do that and then finally to push a sample commit message to that repo.</p>
  
  <p>the script is as follows:</p>
  
  <pre><code>#!/usr/bin/env bash
  
  set -eux
  
  # Json Function: parse_json 'json string' key
  function parse_json()
  {
      echo $1 | sed -e 's/[{}]/''/g' | awk -F=':' -v RS=',' "\$1~/\"$2\"/ {print}" | sed -e "s/\"$2\"://" | tr -d "\n\t" | sed -e 's/\\"/"/g' | sed -e 's/\\\\/\\/g' | sed -e 's/^[ \t]*//g' | sed -e 's/^"//'  -e 's/"$//'
  }
  
  git_create_repo() {
      read -e -p  "Please enter your API Key: " apiKey
      read -e -p  "Repo Name: " repoName
      read -e -p  "Repo Description: " repoDescription
  
      # Use the API to create a a repository
      response=$(curl -i -H 'Authorization: token $apiKey' \
          -d '{ \
                  "name": "$repoName", \
                  "description": "$repoDescription", \
                  "private": false, \
                  "license_template": "mit" \
              }' \
          https://api.github.com/AdamKyle/repos)
  
      echo $response
  }
  
  git_create_repo
  </code></pre>
  
  <p>When I go through all the steps I get:</p>
  
  <pre><code>{
    "message": "Bad credentials",
    "documentation_url": "https://developer.github.com/v3"
  }
  </code></pre>
  
  <p>I am wondering if its because of the way I am putting in my api key with: <code>curl -i -H 'Authorization: token $apiKey ...'</code> I have tried <code>"$apiKey"</code> but even that doesn't work.</p>
  
  <p>Ideas?</p>