GitHub v3 API:如何为我闪亮的新存储库创建初始提交? [英] GitHub v3 API: How to create initial commit for my shiny new repository?

查看:24
本文介绍了GitHub v3 API:如何为我闪亮的新存储库创建初始提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GitHub API 文档说:

GitHub API docs says:

如果存储库的 git 存储库为空或不可用,Git DB API 函数将返回 409.

我在 $repo/git/trees 上的 POST 确实返回 409.

My POST on $repo/git/trees returns 409 indeed.

然后我如何在存储库中创建初始提交?我是否必须强迫用户手动提交一些无用的垃圾,只是为了创建根提交?

How do I create initial commit in the repository then? Do I have to force user to commit some useless junk manually, just for the sake of creating root commit?

推荐答案

我通过电子邮件向 github 支持人员发送了相同的问题,这里是他们的回复:

I emailed github support with the same issue and here is their response:

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.

作为一种解决方法,根据您的用例,您可以创建复刻而不是新的存储库.

As a workaround, depending on your use case, you may be able to create forks rather than new repos.

这篇关于GitHub v3 API:如何为我闪亮的新存储库创建初始提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆