How do I rename a GitHub repository via their API?

Looking at the GitHub API reference at, 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?

  • Git pull only certain number of commits
  • Creating aliases in PowerShell for git commands?
  • execute repo command for some of the repositories
  • Creating atlassian stash repo using rest and powershell
  • Git push - suboptimal pack - out of memory
  • Does each branch have a separate stash?
  • Why is `GIT_EDITOR` set to `:` (colon) within my `commit-msg` hook?
  • Clone and set local repository config in one command
  • conceptual questions about version control
  • How can I view new files that would be introduced on merging branches?
  • Show untracked files in JetBrains intellij for git
  • return code 22, fatal: git-http-push-failed
  • 3 Solutions collect form web for “How do I rename a GitHub repository via their API?”

    Create some variables for clarity:

    newName='{"name": "NewNameForRepo"}'

    Then use curl to make the request:

    curl -u "$user:$pass" -X PATCH -d "$newName"$user/$oldName

    This is possible through the Edit Repository method, but here’s the simplest example to do this with curl:

    curl \
     -H "Authorization: Token [token]" \
     -H "Content-Type:application/json" \
     -H "Accept: application/json" \
     -X PATCH \
     --data '{ "name": "new-repo-name" }' \

    Create a new repo, push to it and delete the old one ?

    Git Baby is a git and github fan, let's start git clone.