Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Github to Gitlab Mirror the repository in php using crontab every minute.

License

Notifications You must be signed in to change notification settings

DeepLinkCode/GithubToGitlab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Github to Gitlab mirror repository in PHP

The idea here is to mirror the repository using crontab every minute.

Installation

Just make sure you have self hosted server or local linux environment.

Also make sure you have Github and Gitlab ssh installed.

  • Set crontab -e
* * * * * sh /path/to/mirror.sh >/dev/null 2>&1
  • Edit mirror.php and set appropriate git ssh config for repository on line number 19 and 22

  • Now everything is in place, but because gitlab keeps it's own "special" branches in place, you might get these kinds of errors:

 ! [remote rejected] refs/keep-around/09c68d4f76f68041438040e3bb4316d5ca1d5135 -> refs/keep-around/09c68d4f76f68041438040e3bb4316d5ca1d5135 (deny updating a hidden ref)
  • We need to filter those out of the branches we do want to mirror. In order to do that we edit the config file again.

  • We should replace fetch = +refs/*:refs/* which basically says, everything, and just select tags, branches and head

[remote "mirror"]
    url = [email protected]:reponame.git
    push = +refs/heads/*:refs/heads/*
    push = +refs/tags/*:refs/tags/*
    mirror = true

Any cause of failure on self-hosted server:

  • The public ssh key of www-data should have read and write access to source repository.
  • If the SSH server is not trusted the connection will fail.
  • To avoid non trusted connection to server, run ssh -T [email protected] and ssh -T [email protected] at least once to get its fingerprint into the local SSH configuration or hosted server ssh configuration.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

Github to Gitlab Mirror the repository in php using crontab every minute.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages