@wendongfly/myhi 1.0.44 → 1.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/myhi.js +7 -0
- package/dist/index.js +93 -93
- package/package.json +1 -1
package/bin/myhi.js
CHANGED
|
@@ -144,6 +144,13 @@ if (cmd === 'attach') {
|
|
|
144
144
|
process.exit(1);
|
|
145
145
|
}
|
|
146
146
|
mkdirSync(dir, { recursive: true });
|
|
147
|
+
// 为用户创建独立的 git 配置(隔离凭据)
|
|
148
|
+
const gitconfigPath = join(dir, '.gitconfig');
|
|
149
|
+
const gitcredPath = join(dir, '.git-credentials');
|
|
150
|
+
if (!existsSync(gitconfigPath)) {
|
|
151
|
+
writeFileSync(gitconfigPath, `[credential]\n\thelper = store --file ${gitcredPath.replace(/\\/g, '/')}\n[user]\n\tname = ${name}\n`, { mode: 0o600 });
|
|
152
|
+
console.log(`[myhi] 已创建 git 配置: ${gitconfigPath}`);
|
|
153
|
+
}
|
|
147
154
|
const data = loadUsersFile();
|
|
148
155
|
data.users[pwd] = { name, dir };
|
|
149
156
|
saveUsersFile(data);
|