There are many answers on Google that point in the same direction, but when it comes to version control I don't want to try anything and then mess up my repository.
I have set up a repository on GitHub and would like to move it to another user, so that I can close the repository. He would then invite me to the repo once it belongs to his account. I guess this is quite a common use case for working with clients - once you finished the project, you hand it over to them.
Now, assuming this is possible, how would I change my local Git settings in the project so that I am now pushing to/pulling from the new location? And, by moving the repo, would I lose the commit history?
If you're using Git, you'll first need to clone the repo you want to copy locally. Then, create a new empty repository in the account you want to add the repo. Finally, add your remote and push the files from the local repo to the new Beanstalk account using the git push command.
Transferring a repository owned by your personal accountUnder your repository name, click Settings. Click Transfer. Read the warnings and enter the repository name to confirm that you've done so. Type the name of the new owner and click I understand, transfer this repo.
Any of the following will work:
Just transfer ownership of the repo to another user and have them add you as a collaborator.
If someone forks your repo, then you delete the original, their fork is still there, unless it's a private repository. they can then add you as a collaborator on their fork repo.
Another user can simply clone your repo (commits intact), create a new repo on GitHub, add the new repo's remote info, and push your repo up to their new one. (Then, they can add you as a collaborator.)
To answer the questions:
You would not lose anything - not even commit history. The point of Git is that it is decentralized - everybody with a copy of the repository has everything. Just the new repo.
It is easy to change the git settings to push to the new repository. You can either use
git remote set-url origin git://new.url.here
or edit the .git/config
file.
I would say you should:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With