Home > Net >  Want to migrate git repository from git client to another gitlab server
Want to migrate git repository from git client to another gitlab server

Time:06-14

I am facing a situation where, I have two different git lab servers, consider "A" and "B". I pulled one project repository from server "A" to my local client. Now, i want to push this local repository to server "B". But during this migragtion, i want to keep all the previous commits and configs saved on new server too. (which means, i cannot create a fresh repository on server "B" from the local data)

Note : I lost access to git server "A", and just have a local repository on git client, so cannot copy or export project directly from git server to server.

CodePudding user response:

All your history is kept in the .git folder that you have in local. So all your commits are already saved. But you will lose Gitlab A configuration since this is not related to git and Gitlab specific. If you want to keep everything, you have to make the export if possible or you can keep only commits and git related stuff.

You have to create a blank project on Gitlab B and follow the "Push an existing Git repository" steps :

cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab_B_url/GROUP/PROJECT.git
git push -u origin --all
git push -u origin --tags
  • Related