How do I rename a GitHub repository via their API?

前端 未结 4 1628
隐瞒了意图╮
隐瞒了意图╮ 2020-12-16 04:19

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.

4条回答
  •  醉梦人生
    2020-12-16 04:21

    Create some variables for clarity:

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

    Then use curl to make the request:

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

提交回复
热议问题