title: Send to github via curl command line (Windows)
body: <p>I asked a <a href="https://stackoverflow.com/questions/15034471/using-git-and-curl-command-line">related</a> question and realized I wasn't asking the right question (i.e., this isn't about git).</p>
  
  <p>The question is how to push a project to github without first creating the project in the clouds using R. Currently you can do this from the git command line in RStudio using info from <a href="https://stackoverflow.com/questions/14912161/repo-from-rstudio-to-github">this question</a>.</p>
  
  <p>Now I'm trying to make that into R code now from a Windows machine (Linux was easy).  I'm stuck at the first step using curl from the command line via an R <code>system</code> call.  I'll show what I have and then the error message (<a href="https://stackoverflow.com/a/15038461/1000343">Thanks to SimonO101 for getting me this far.</a>).  Per his comments below I've edited heavily to reflect the problem as it:</p>
  
  <p><strong>R Code:</strong></p>
  
  <pre><code>repo &lt;- "New"
  user &lt;- "trinker"
  password &lt;- "password"
  
  url &lt;- "http://curl.askapache.com/download/curl-7.23.1-win64-ssl-sspi.zip"
  tmp &lt;- tempfile( fileext = ".zip" )
  download.file(url,tmp)
  unzip(tmp, exdir = tempdir())
  
  system(paste0(tempdir(), "/curl http://curl.haxx.se/ca/cacert.pem -o " , 
      tempdir() , "/curl-ca-bundle.crt"))
  
  cmd1 &lt;- paste0(tempdir(), "/curl -u '", user, ":", password, 
      "' https://api.github.com/user/repos -d '{\"name\":\"", repo, "\"}'")
  
  system(cmd1)
  
  cmd2 &lt;- paste0(tempdir(), "/curl -k -u '", user, ":", password, 
      "' https://api.github.com/user/repos -d '{\"name\":\"", repo, "\"}'")
  
  system(cmd2)
  </code></pre>
  
  <p><strong>Error Messages (same for both approaches):</strong></p>
  
  <pre><code>&gt; system(cmd1)
    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                   Dload  Upload   Total   Spent    Left  Speed
  
    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  100    12    0     0  100    12      0     24 --:--:-- --:--:-- --:--:--    30
  100    47  100    35  100    12     65     22 --:--:-- --:--:-- --:--:--    83{
    "message": "Bad credentials"
  }
  </code></pre>
  
  <p>I know all the  files are there because:</p>
  
  <pre><code>&gt; dir(tempdir())
  [1] "curl-ca-bundle.crt"   "curl.exe"             "file1aec62fa980.zip"  "file1aec758c1415.zip"
  </code></pre>
  
  <p>It can't be my password or user name because this works on Linux Mint (the only difference is the part before curl):</p>
  
  <pre><code>repo &lt;- "New"
  user &lt;- "trinker"
  password &lt;- "password"
  
  
  cmd1 &lt;- paste0("curl -u '", user, ":", password, 
      "' https://api.github.com/user/repos -d '{\"name\":\"", repo, "\"}'")
  
  system(cmd1)
  </code></pre>
  
  <p><strong><em>NOTE: Windows 7 machine.  R 2.14.1</em></strong></p>