Importing a Private Repo Between GitHub Accounts
How to move a private repository to another GitHub account using the built-in Importer, including PAT scopes and the default-branch fix.
Moving a private repo to another GitHub account (e.g. a personal repo into the company org) can be done with GitHub's built-in Importer at github.com/new/import. It clones the source repo and pushes it into a fresh destination repo. The one part that trips people up is authentication: the credentials you supply belong to the source account, not the destination.
How the Importer authenticates
The Importer needs to read/clone your private source repo, so it asks for a username and a Personal Access Token. Both must belong to the account that currently owns the repo — the account you're copying from.
If you generate the token on the destination account, it has no line of sight to the source repo and the import fails with Invalid username or token. Create the token while logged into the source account.
Import procedure
Start a new import
Go to github.com/new/import. Set the owner to the destination account and give the new repo a name.
Source URL
Enter the URL where the repo lives right now — the account you're copying from:
https://github.com/SOURCE-ACCOUNT/repo-nameA trailing .git is optional. The greyed git.example.org text is only a format placeholder.
Credentials
- Username → the source account's GitHub username.
- Access token → a PAT generated on the source account (see below). Paste it straight into the masked field; GitHub only shows a token string once.
Creating the token
You only need read access to the source repo, so keep the token minimal and short-lived (a 7-day expiry is plenty for a one-off migration — revoke it afterwards).
- Resource owner → the source account
- Repository access → Only select repositories → pick the repo being imported
- Repository permissions → Contents: Read-only (Metadata: Read-only is added automatically and can't be removed)
- Account permissions → leave empty — none of that touches repo code
Tick the top-level repo scope (full control of private repositories). Classic tokens can't be scoped per-repo, so repo is the single checkbox that grants private-repo read access.
Repository permissions vs Account permissions: Account permissions cover your user profile (followers, SSH/GPG keys, email addresses) and have nothing to do with reading a repo. Leave them untouched.
Troubleshooting a failed clone
A failure email may look alarming but is mostly noise. The meaningful line is:
remote: Invalid username or token.
Password authentication is not supported for Git operations.Ignore the generic "This could be due to IP allowlisting on the source" note — GitHub appends it to every clone failure. If the error arrives by email, any safelinks.protection.outlook.com wrapping around the URLs is just Outlook rewriting links, not part of the problem.
Usual causes, roughly in order:
- Token from the wrong account — it must be created on the source account, not the destination.
- Fine-grained token not scoped to this repo — the exact repo must appear under Repository access with Contents: Read-only.
- Typo or trailing whitespace when pasting into the masked field — regenerate and paste carefully.
- Expired token, or the account password entered instead of the token.
- Classic token missing the
reposcope.
Confirm the token works before retrying the Importer:
git clone https://SOURCE-USERNAME:YOUR_TOKEN@github.com/SOURCE-ACCOUNT/repo-name.gitIf that clones, the token is good and you just re-enter it in the Importer. If it fails the same way, fix the token/scope.
Fixing the default branch
The Importer copies the source repo's default branch setting, so the destination inherits whatever the source used (e.g. preview instead of main).
Confirm the branch exists
Open the destination repo's branch dropdown or .../branches. If your intended default (e.g. main) isn't listed, create it first from the existing branch, then continue.
Switch the default
In the destination repo: Settings → General → Default branch → click the ⇄ swap icon → pick the branch → Update.
Clear the confirmation modal
A modal warns that the change can affect open PRs and checked-out branches. Click "I understand, update the default branch."
This final modal is the common trap: if you click Update but dismiss or ignore the modal, the change silently doesn't apply and Settings looks like it's refusing to save.
Reload the repo homepage; the dropdown should now show the new default. Afterwards you may want to delete the stray inherited branch so the company repo starts clean.
Alternatives to the Importer
Since you own both accounts, two other routes avoid the token dance entirely:
- Transfer the repo — repo Settings → General → Danger Zone → Transfer ownership. Moves it in one step and keeps issues, PRs, and stars (the Importer copies only the Git history/code).
- git mirror — clone bare and push to an empty destination repo:
git clone --bare https://github.com/SOURCE-ACCOUNT/repo-name.git
cd repo-name.git
git push --mirror https://github.com/DEST-ACCOUNT/repo-name.gitCompany iPhone SE Recovery Mode & Re-Provisioning Guide
Technical guide for IT administrators on how to recover and re-provision company-owned iPhone SE devices that are locked or have unknown passcodes, including handling Activation Lock scenarios.
Permanently remove git-history files
Instruction on how to permanently remove files from the git-history.