Alm*_*mad 8 git api github github-api
GitHub API文档说:
Git DB API functions will return a 409 if the git repo for a Repository is empty or unavailable.
我POST上$repo/git/trees确实返回409.
我如何在存储库中创建初始提交呢?我是否必须强制用户手动提交一些无用的垃圾,只是为了创建root提交?
我通过电子邮件向github支持发送了同样的问题,以下是他们的回复:
From: Rick (GitHub Staff)
Subject: Creating an initial commit using the v3 API
Currently, you can't add the initial commit through the API. Thanks for the
feedback. I've added your suggestion to the Feature Request List™ for the team
to see.
Run Code Online (Sandbox Code Playgroud)
作为一种解决方法,根据您的使用案例,您可以创建分叉而不是新的回购.
2012年9月28日更新
根据这一博客帖子在github博客上发布,现在它可以自动创建初始化后的资源库.
今天,我们通过GitHub API更轻松地将提交添加到存储库.到目前为止,您可以创建一个存储库,但在通过API添加任何提交之前,您需要通过Git客户端在本地初始化它.
现在,您可以选择通过为auto_init参数发送true来初始化存储库:
curl -i -u pengwynn \
-d '{"name": "create-repo-test", "auto_init": true}' \
https://api.github.com/user/repos
Run Code Online (Sandbox Code Playgroud)
生成的存储库将具有README存根和初始提交.
| 归档时间: |
|
| 查看次数: |
1936 次 |
| 最近记录: |