za pomocą linii poleceń git i curl

Próbuję napisać funkcję, która wypchnie projekt do github bez uprzedniego utworzenia projektu w chmurach. Obecnie możesz to zrobić z linii poleceń git w RStudio, korzystając z informacji zto pytanie.

Teraz próbuję zawinąć to w funkcję, której mogę użyćsystem stworzyć repo w chmurach z lokalnego repo. Pracuję nad tym na komputerze z systemem Windows i Linux (nie wiem jeszcze, jak dobrze działa to na mac). Oto mój kod do tej pory (wykrywanie lokalizacji git):

gitpath <- NULL
    repo <- "New"
    user <- "CantPostThat"
    password <- "blargcats"


if (Sys.info()["sysname"] != "Windows") {
    gitpath <- "git"
} else {
    if (is.null(gitpath)){  
        test <- c(file.exists("C:\\Program Files (x86)\\Git\\bin\\git.exe"),
            file.exists("C:\\Program Files\\Git\\bin\\git.exe"))
        if (sum(test) == 0) {
            stop("Git not found.  Supply path to 'gitpath'")    
        }
        gitpath <- c("\"C:\\Program Files (x86)\\Git\\bin\\git\"",
            "\"C:\\Program Files\\Git\\bin\\git\"")[test][1]
    }
}

Następnie spróbujęsystem:

system(paste(gitpath, "--version"))

> system(paste(gitpath, "--version"))
git version 1.7.11.msysgit.1

Wygląda dobrze. Ale potem próbuję na prawdziwym kawałku kodu:

cmd1 <- paste(gitpath, paste0("curl -u '", user, ":", password, 
    "' https://api.github.com/user/repos -d '{\"name\":\"", repo, "\"}'"))

system(cmd1)

I otrzymaj wiadomość:

> system(cmd1)
git: 'curl' is not a git command. See 'git --help'.

Did you mean this?
    pull
Warning message:
running command '"C:\Program Files (x86)\Git\bin\git" curl -u ' trinker : PASSWORD ' https://api.github.com/user/repos -d '{"name":" three "}'' had status 1 

Jak mogę uruchomić to polecenie:

curl -u 'USER:PASS' https://api.github.com/user/repos -d '{"name":"REPO"}' z konsoli.

Próbowałem również uruchomić bez wstawiania git z przodu. Obecnie jestem na maszynie wygrywającej 7

questionAnswers(1)

yourAnswerToTheQuestion