简体   繁体   中英

How to automatic change git repository domain on the clients when pull?

I have self-hosted Gitlab installation on a domain. And I need to move Gitlab instance to a different domain. Almost all another Gitlab data will be saved and migrated to a new location.

Is there a solution to automatically and handless change git origin <URL> for any git clients when they perform next pull from the old location? Could be something like server controlled hooks.

As far I know, you can't from the git server alter the repo url in the "client" side. To do it, you have run some type of script on the "client", but the solution will depend on the OS and the connection type (https ou ssh).

One option is keep the old gitlab online and create a pre-receive hook to deny any push and send back a message like:

   Hey dude! Your project is not here anymore, please access http://newdomain or
   run git `remote set-url http://newdomain/project.git` 

More about gitlab server-side hooks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM