How to push a Git server repository issues to Github repository?

I have a repository on the Git Server like Bitbucket and now I want to switch to Github. So I make a copy of my repository on the Github successfully, but the my repository issues (Nearly 200 issue) not copied on the Github repository!

Exist a way to copy all issues on the Github repository without inserting one by one manually !?

  • How do i set a private ssh key for hudson / jenkins to access bitbucket?
  • Managing Git or bitbucket repositories through Sublime text
  • Importing commit history from Bitbucket to Github
  • How do I view older iterations of binary (image or non-code) files from a git repository?
  • Git clone / pull continually freezing at “Store key in cache?”
  • Is it possible to create a Heroku review app from a Bitbucket pull request
  • Fine-tuning gitk encoding
  • Why is Jenkins getting Authentication Failed error for git submodule update?
  • Very strange git behavior when merging old branch into develop
  • Git subtree merge strategy, possible without merging history?
  • On GitHub, can I fork just a wiki?
  • SSMS version control and source control integration with git?
  • One Solution collect form web for “How to push a Git server repository issues to Github repository?”

    As choroba has said above you can use the BitBucket API to retrieve your current list of issues, or details on a specific issue. Have a look at https://confluence.atlassian.com/display/BITBUCKET/Use+the+Bitbucket+REST+APIs for more info on this. In a nutshell, you can make a request to https://api.bitbucket.org/2.0/repositories/<repo-owner-username>/<repo-name>/issues/<ID> and get back a JSON response of the issue details. You can go to https://api.bitbucket.org/2.0/repositories/tutorials/tutorials.bitbucket.org/issues/1 in your browser to see an example of what the response looks like.

    Since you wan’t to migrate all your issues you can repeatedly make a request to https://api.bitbucket.org/2.0/repositories/tutorials/tutorials.bitbucket.org/issues/<ID>, where ID ranges from 1 to however many issues you have.

    Once you have the existing issue details you’ll need to write some code to parse the JSON and then use the information provided by BitBucket to make a request to GitHub’s API to create the new issue.

    You can read up on GitHub’s API at https://developer.github.com/v3/issues/#create-an-issue. Basically for this you’ll make a POST request to https://api.github.com/repos/<repo-owner-username>/<repo-name>/issues and provide the necessary parameters along with the request. Exactly how you do this will depend on the library you use to make the request. Using CURL the request might look like curl -H "Content-Type: application/json" -X POST -d '{"title":"Found an issue","body":"I'm having a problem with this."}' https://api.github.com/repos/behzad-khosravifar/myRepo/issues.

    So putting it all together the pseudocode might look something like:

    for (id = 1 to 100)
        issueRawData = http_get('https://api.bitbucket.org/2.0/repositories/<owner>/<repo>/issues/'+id)
        issueJson = JSON.parse(issueRawData);
        postData = { "title" : issue.title, "body" : issue.content.raw }
        http_post('https://api.github.com/repos/<repo-owner-username>/<repo-name>/issues/'+id, postData)
    }
    

    Extra & Gotchas

    • Iterating over all the issues will mean you’re creating issues in GitHub based on issues that have been closed in BitBucket. You can check the ‘state’ field returned from BitBucket to conditionally create the issue in GitHub. Alternatively create the issue anyway and then use GitHub’s API to close the issue after its’ been created.
    • You’ll need to authenticate with GitHub (and possibly BitBucket). https://developer.github.com/v3/auth/ gives details on how to provide auth details when creating the issues in GitHub.
    Git Baby is a git and github fan, let's start git clone.