Is it possible change endpoint in .git files from Bit Bucket to GitHub and make commit also to GitHub with all commits history?
Asked
Active
Viewed 2,385 times
0
-
Possible duplicate of [How to migrate GIT repository from one server to a new one](https://stackoverflow.com/questions/1484648/how-to-migrate-git-repository-from-one-server-to-a-new-one) – phd Jun 04 '19 at 09:31
-
https://stackoverflow.com/search?q=%5Bgit%5D+migrate+history – phd Jun 04 '19 at 09:32
1 Answers
2
You just have to change your local repositorys' remote. From this article, describing how to move from GitHub to BitBucket:
Change the origin URL
- Go to the repository on your local machine on the command line
- Type: git remote -v. This should show that the repo origin is still on github. E.g.
origin https://USERNAME@github.com/USERNAME/REPONAME.git (fetch) origin https://USERNAME@github.com/USERNAME/REPONAME.git (push)
- Edit the git config file for the repository: sudo nano .git/config
- Change url (under remote "origin") and change github.com to bitbucket.com. You may need to change the username if your username is different on bitbucket. You should also change it to the git URL. i.e. git@bitbucket.org:USERNAME/REPONAME.git
You just have to switch GitHub and BitBucket. Be sure to be up to date in your local repository (i.e. git pull
before).
The GitHub repository should be a newly created, empty repository. Performing git push
will move all your code with commit history to the new repo.

kowsky
- 12,647
- 2
- 28
- 41
-
1You should also make sure that anybody else working on that repo updates their stuff. – Jim Redmond Jun 04 '19 at 18:20