我如何通过API重命名GitHub存储库? [英] How do I rename a GitHub repository via their API?

查看:88
本文介绍了我如何通过API重命名GitHub存储库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查看 http://develop.github.com/p/repo上的GitHub API参考资料.html ,我看到各种各样的好东西,但我没有看到任何通过API重新命名存储库的方法。有没有办法做到这一点?

Looking at the GitHub API reference at http://develop.github.com/p/repo.html, I see all sorts of good stuff, but I don't see any way to rename a repository through the API. Is there any way to do so?

推荐答案

为清晰起见创建一些变量:

Create some variables for clarity:

user=MyUserName
pass=MyPassword
newName='{"name": "NewNameForRepo"}'
oldName="MyRepo"

然后使用curl发出请求:

Then use curl to make the request:

curl -u "$user:$pass" -X PATCH -d "$newName" https://api.github.com/repos/$user/$oldName

这篇关于我如何通过API重命名GitHub存储库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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