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

This bash program helps to migrate or deploy git projects with many submodules from a private area (like a LAN), to a public area (like github).

License

Notifications You must be signed in to change notification settings

Blackstareye/deepcopy_submodules

Repository files navigation


Logo

Deep Copy of Submodules

This bash program helps to migrate or deploy git projects with many submodules from a private area (like a LAN), to a public area (like github).
Report Bug · Request Feature

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Contributing
  6. License
  7. Contact
  8. Acknowledgements

About The Project

Console Example Output

This bash program helps to migrate or deploy git projects with many submodules from a private area (like a LAN), to a public area (like github).

I made it because I had exactly that situation: having a local git server AND a public one. When I wanted to migrate some Projects (and they had many submodules) the issue was always doing the exactly steps over and over again:

  1. cloning the project from the private repo
  2. changing the .gitmodules file and changing each url to the "new remote"
  3. changing the .git/conf file and changing each url to the "new remote"
  4. deleting the modules from .git/modules and /modules
  5. adding remote and push each submodule
  6. adding remote and push "root" git repo

Also it was a mess doing that steps over and over and then realising it's a faulty url...

So I made this project.

Funfact - Trivia

I also tried some test concepts I learned in university for testcoverage. It was also an ..let's say experience writing unit test in and for bash oO.

Have a look on Test Coverage

Getting Started

To get a local copy up and running follow these simple steps.

  1. clone the repo
  2. have a look on the config.conf (see config)
  3. cd to the cloned repo and run install.sh:
    1. cd <cloned_repo>

    2. bash install.sh

  4. run the program
    1. bash deep_copy_submodules.sh "remote" "<private_url>" "<public_url>"

Usage

# try deep deep_copy_submodules.sh --usuage for usuage information
deep deep_copy_submodules.sh --usuage

# remote private repo
bash deep_copy_submodules.sh "remote" "https://privatefoo.bar" "https://public_foo.bar"
# ssh private repo
bash deep_copy_submodules.sh "ssh" "git@git-server" "https://public_foo.bar"
# local private repo
bash deep_copy_submodules.sh "local" "/foo/bar/git_repo" "<public_url>"

Parameter

  • --help Shows the help for that script
  • --usuage Shows the usuage for that script
  • -v Enables Validation if it is in config not set
  • -t Enables Testing_Connections if it is in config not set

Validation: The Connection can be checked before they will be progressed with this flag. This will enable syntax checking of the given urls and parameters. If also Testing Connections is enabled, the connections will also be checked with curl.

Testing Connections: Connections can be checked before they will be progressed with this flag. A curl request will be used for checking

WARNING: If validation is turned off, the urls will be used as they are with no further checking. use this with caution or if you know what you do.

Config

The Config explanation is added directly to the given config parameter. see: config

IMPORTANT NOTES

  • SSH can only be used for the first repo not for the uploading target repo
  • Git-Submodules can only be parsed if they don't contain a '-' "dash" in the folder and or module name
    • this relies on the fact, that I parse the sections of the .gitmodules ini into dynamic variables like
      • $configuration_submodule[key]=value

Known Issues

Unfortunately projects with git lfs do not work on the sytems I use it. So I can't guarantee if it will work. But this is the first issue I will hunt down and fix.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

If you have an idea for amazing feature or a nice way to do things more easily in bash you can submit it like the following:

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Testing

Have a look on

License

Distributed under the GPL version 3. See LICENSE for more information.

Images are licensed under the License Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)

Contact

Blackeye - @BlackeyeM - [email protected]

Project Link: https://github.com/Blackstareye/deepcopy_submodules

Acknowledgements

For Testing, thanks for those amazing projects, that make bash unit testing AT LEAST doable.

Additional Info

used Language

bash

used Software

bats, shellchecker

Status

published

About

This bash program helps to migrate or deploy git projects with many submodules from a private area (like a LAN), to a public area (like github).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages