If you haven’t already, clone the personal repo to your local machine:
git clone https://github.com/yourusername/your-personal-repo.git
cd your-personal-repo
Find the URL of the organization repo where you want to push the code. Add it as a new remote:
git remote add org-origin https://github.com/organization-name/organization-repo.git
You can verify the remotes using:
git remote -v
Push the code from your local machine to the organization repo:
git push org-origin main
Replace main
with your branch name if it's different.
Once you've successfully pushed the code to the organization repo:
-
Remove the remote for the personal repo (optional):
git remote remove origin
This prevents accidental pushes to your personal repo.
-
Delete the personal repo from GitHub:
If you no longer need the personal repo, you can delete it from GitHub.
Go to the organization repo on GitHub and verify that all your code has been successfully pushed.
Let me know if you encounter any issues!