DEV Community

Ajit Kumar
Ajit Kumar

Posted on

Transfer, Copy, or Mirror: Playing with Ownership of Github Repo: ChatGPT notes

Migrating a GitHub repository to a new account can be done through several approaches depending on whether you want to retain the commit history, transfer ownership, or create a fresh repository. Here’s a detailed guide:


Option 1: Transfer Ownership

This is the best option if you want to retain the repository’s history and issues and fully migrate it to a new GitHub account or organization.

  1. Prerequisites:

    • You must have admin permissions for the repository.
    • The new account must accept the transfer.
  2. Steps:

    • Go to the repository in the source account.
    • Navigate to Settings > General.
    • Scroll down to the Danger Zone section and click Transfer.
    • Enter the repository name and the new owner’s GitHub username or organization.
    • Confirm the transfer.

Once transferred, the repository is fully owned by the new account.


Option 2: Clone and Push to a New Repository

If you want to copy a repository without transferring ownership:

  1. Clone the Repository:
   git clone https://github.com/old-account/repo-name.git
   cd repo-name
Enter fullscreen mode Exit fullscreen mode
  1. Change the Remote URL:

    • Create a new repository in the new account.
    • Update the remote URL to point to the new repository:
     git remote set-url origin https://github.com/new-account/repo-name.git
    
  2. Push to the New Repository:

   git push origin main
Enter fullscreen mode Exit fullscreen mode

Replace main with the default branch of your repository.

  1. Update Submodules (if any): If your repository has submodules, update their URLs as well.

Option 3: Mirror the Repository

If you want to create an exact copy:

  1. Mirror Clone the Repository:
   git clone --mirror https://github.com/old-account/repo-name.git
Enter fullscreen mode Exit fullscreen mode
  1. Push to the New Repository:

    • Create a new repository in the new account.
    • Push the mirrored repository:
     cd repo-name.git
     git push --mirror https://github.com/new-account/repo-name.git
    

This ensures all branches, tags, and history are copied.


Notes:

  • Issues and Pull Requests:

    • GitHub does not migrate issues, pull requests, or wikis automatically. Use third-party tools like gh-issues-migrate or export data manually.
  • Repository Visibility:

    • Ensure the new repository’s visibility (public/private) matches your preferences.
  • Webhook and Settings:

    • Reconfigure any webhooks or integrations for the new repository.

This approach ensures your repository, history, and setup are correctly migrated to your new account!

Image of AssemblyAI tool

Transforming Interviews into Publishable Stories with AssemblyAI

Insightview is a modern web application that streamlines the interview workflow for journalists. By leveraging AssemblyAI's LeMUR and Universal-2 technology, it transforms raw interview recordings into structured, actionable content, dramatically reducing the time from recording to publication.

Key Features:
🎥 Audio/video file upload with real-time preview
🗣️ Advanced transcription with speaker identification
⭐ Automatic highlight extraction of key moments
✍️ AI-powered article draft generation
📤 Export interview's subtitles in VTT format

Read full post

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay