Managing Git repositories can sometimes get tricky, especially when you're switching between accounts (like an organization and a personal account). This guide walks you through the process of pushing your local repository to a remote origin and ensuring the correct account credentials are used.
https://github.com/username/repository.git).If you’ve already initiated Git locally, link it to your remote repository using:
git remote add origin <remote-repository-URL>
Push the local code to the remote repository:
git push -u origin main
Replace main with your branch name if it’s different (e.g., master). The -u flag sets the upstream branch for easier future pushes.
If your system is still using the credentials of an old organization account while you want to push to your personal account, follow these steps:
Update your local and global configurations to ensure the correct username and email are used: