
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
git-setup-submodules
Advanced tools
This script automates the setup of Git submodules in your project based on a configuration file. It reads the configuration, checks access to the specified repositories, adds them as submodules at specified paths, and sets them to specific branches or tags.
You can use the script as a local dependency in your project or run it directly using npx
.
Navigate to Your Project Directory
cd /path/to/your/project
Install the Package
npm install git-setup-submodules --save-dev
npx
You can run the script without installing it by using npx
:
npx git-setup-submodules
Create a configuration file named .git-setup-submodules
in the root directory of your project. This file lists the submodules to be added along with their configurations.
Each line in the configuration file represents a submodule and follows this format:
<remote-path>[:<local-path>][#<branch-or-tag>]
<remote-path>
: Path to the submodule repository relative to your Git remote URL base.<local-path>
(optional): Custom local directory name for the submodule. Defaults to the module name if omitted.<branch-or-tag>
(optional): Branch or tag to check out. Defaults to main
if omitted.Basic Submodule
libs/utils
utils
from libs/utils
into libs/utils
, checking out the main
branch.Custom Local Path
apps/website:site
website
from apps/website
into apps/site
, checking out the main
branch.Specific Branch
libs/logger#v1.2.3
logger
from libs/logger
into libs/logger
, checking out the v1.2.3
branch or tag.Custom Path and Branch
apps/website:site#production
website
from apps/website
into apps/site
, checking out the production
branch.#
or //
are treated as comments.# Submodules Configuration
# Add the utils library
libs/utils
# Add the website app to 'site' directory on 'production' branch
apps/website:site#production
# Add the logger library at tag 'v1.2.3'
libs/logger#v1.2.3
// Add the helpers library to 'helpersLib' directory
libs/helpers:helpersLib
// Add the console app
apps/console
If you've installed the script as a local dependency, you can run it using npx
:
npx git-setup-submodules
Alternatively, you can add a script to your package.json
:
{
"scripts": {
"setup-submodules": "git-setup-submodules"
}
}
Then run:
npm run setup-submodules
npx
DirectlyIf you haven't installed the script locally, you can run it directly with npx
:
npx git-setup-submodules
Check for Existing .gitmodules
.gitmodules
exists, the script assumes submodules are already initialized and exits.Read Configuration File
.git-setup-submodules
for submodule definitions.Determine Remote URL Base
Process Each Submodule
For each submodule in the configuration:
git ls-remote
to check if you have access to the repository.git submodule add --force
to add the submodule.git pull
.git restore --staged
to unstage the submodule and .gitmodules
.Final Output
Missing Configuration File
.git-setup-submodules
is not found.Git Repository Not Found
Access Denied to Submodule
Progress Messages
Access Notifications
Final Status
Fork the Repository
Create a Feature Branch
git checkout -b feature/your-feature-name
Commit Your Changes
git commit -m "Add your feature"
Push to Your Fork
git push origin feature/your-feature-name
Open a Pull Request
This project is licensed under the Apache 2.0.
FAQs
A script to setup git submodules from a configuration file
The npm package git-setup-submodules receives a total of 0 weekly downloads. As such, git-setup-submodules popularity was classified as not popular.
We found that git-setup-submodules demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.