-2

I am trying to merge 2 gitlab repos with all history but failing. Are there any gui tools or script to achieve it?

Since this is going to be a ongoing activity I am looking for something easier way

Hugo y
  • 1,421
  • 10
  • 20

1 Answers1

1

Just use the existing tools provided by git:

You can register one of your repos as origin and one as upstream...

git remote set-url origin git@xxx...
git remote set-url upstream git@xxx...

...then you can merge your changes from one repo into the other by first checking out your origin...

git checkout -b mybranch origin/mybranch

...and then merging your upstream into your local branch

git merge upstream/somebranch

... then pushing back into your origin

git push origin mybranch

Hope this helps

Felix K.
  • 14,171
  • 9
  • 58
  • 72
  • thanks, it worked. is there a way i can pass username and password while cloning and also while pushing? as I would like to put the whole process in the script and schedule it via cron job – krishna chaitanya Sep 18 '18 at 20:46
  • you are welcome. please mark the question as answered then :) regarding your password-related question: sure, you can use a [credential manager](https://stackoverflow.com/questions/35942754/how-to-save-username-and-password-in-git) with git, which stores the passwords. If you are using gitlab as git repository, then you could also generate a [deploy token](https://docs.gitlab.com/ee/user/project/deploy_tokens) and [deploy keys](https://docs.gitlab.com/ee/ssh/#deploy-keys) which you can store on your machine running the cron job which then act as authentication tokens for read/write access. – Felix K. Sep 19 '18 at 07:39