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
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:
- cloning the project from the private repo
- changing the .gitmodules file and changing each url to the "new remote"
- changing the .git/conf file and changing each url to the "new remote"
- deleting the modules from .git/modules and /modules
- adding remote and push each submodule
- 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.
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
To get a local copy up and running follow these simple steps.
- clone the repo
- have a look on the config.conf (see config)
- cd to the cloned repo and run
install.sh
:-
cd <cloned_repo>
-
bash install.sh
-
- run the program
-
bash deep_copy_submodules.sh "remote" "<private_url>" "<public_url>"
-
# 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>"
- --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.
The Config explanation is added directly to the given config parameter. see: config
- 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
- this relies on the fact, that I parse the sections of the .gitmodules ini into dynamic variables like
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.
See the open issues for a list of proposed features (and known issues).
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:
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Have a look on
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)
Blackeye - @BlackeyeM - private_blackeye+deepcopy@posteo.de
Project Link: https://github.com/Blackstareye/deepcopy_submodules
- Talks, raw testing, helpful tips and Opinions: Columbarius
- Readme Template
For Testing, thanks for those amazing projects, that make bash unit testing AT LEAST doable.
bash
bats, shellchecker
published