Mirror Gitea repo to Github

Hi all, I’m curious if there’s anyway to have a repo in github that is just a mirror of a repo in my gitea instance? Basically I want to do the opposite of mirroring a github repo. Is it possible or would I just have to manually push to both? Thank you ^^

@kiwi it is pretty easy to do it with Gitea. To mirror your Gitea repository, carry out the following steps:

  • Register for the GitHub Developer Program, then go to the Settings page on GitHub and generate a personal access token with the repo scope.

  • Create a repository on GitHub.

  • Go to the settings of your Gitea repository and navigate to the Git Hooks section.

  • Edit the post-receive hook and populate the text area with the script given below:

      #!/bin/bash
      git push --mirror --quiet https://<gitea-user>:<gh-token>@github.com/<gh-user>/<gh-repo>.git &> /dev/null
      echo "GitHub Updated"
    
  • Click on Update Hook and push to the Gitea repository.

  • You will likely receive the following message on the terminal if the GitHub mirror was updated successfully:

    remote: . Processing 1 references
    remote: Processed 1 references in total
    remote: GitHub Updated
    To <gitea-host>:<gitea-user>/<gitea-repo>.git
       xxxxxxx..xxxxxxx  <local-branch> -> <remote-branch>
    

Hope it works for you!