如何使用Github API推送代码?

我想通过nodejs应用程序将目录推送到Github。 这是我目前所做的。 我从用户采取用户名,密码和新的存储库名称。 然后,我通过Github API( https://developer.github.com/v3/repos/#create )创build新的存储库。 现在我想推送一些特定的代码到这个仓库。 我不能使用node.jssubprocess(git push origin master),因为那需要用户名和密码。 我如何通过API将代码推送到Github。 (如果通过命令行,然后没有手动input密码)

要跳过每次提交的密码,您需要告诉git将凭据存储在一个单独的位置。 这可以通过使用以下命令来完成:

git config --global credential.helper cache 

这将存储密码15分钟 。 如果您希望可以通过指定持续时间(以毫秒为单位)来延长此时间:

 git config --global credential.helper "cache --timeout=3600"