Repo from RStudio to Github

前端 未结 2 1258
粉色の甜心
粉色の甜心 2020-12-10 11:31

I love github and RStudio for workflow. Recently, I\'ve created a project template that makes directories and scripts etc. and would like to create locally and push to gith

相关标签:
2条回答
  • 2020-12-10 11:56

    The only way you could create a repository on github directly from your computer, without having to create it with their website first, would be to create a remote branch directly from git on your system. This is possible on some git installation, but not on Github.

    However, Github provides an API that allows to create the repository from the command line, via a call to curl for example. You will find information on how to do it in this answer (not tested) :

    curl -u 'USER:PASS' https://api.github.com/user/repos -d '{"name":"REPO"}'
    git remote add origin git@github.com:USER/REPO.git
    git push origin master
    

    But I don't think you will be able to do it directly from RStudio : you will need to put your project under version control, and then to execute the three commands provided in the answer in a shell.

    0 讨论(0)
  • 2020-12-10 12:09

    Have you seen hub?

    hub create
    git push -u origin master
    

    will do the job for you, once hub is configured to access your GitHub account. If you want the project to be called different from the name of the parent directory, use

    hub create projectname
    

    The general usage is

    hub create [NAME] [-p] [-d DESCRIPTION] [-h HOMEPAGE]
    

    (-p -- private repository), and you can access many more GitHub features with this tool.

    0 讨论(0)
提交回复
热议问题