MCPcopy Create free account
hub / github.com/Tencent/teamai-cli / fetchAuthHeader

Function fetchAuthHeader

src/clone.ts:293–307  ·  view source on GitHub ↗

* Resolve an `http.extraHeader` auth value for a follow-up `git fetch`, so the * token stays out of the remote URL and out of `.git/config` (it is passed * per-invocation via `-c`). Mirrors the token providers handled in shallowClone * that inject via extraHeader rather than embedding creds in th

(provider?: string)

Source from the content-addressed store, hash-verified

291 * Git credentials.
292 */
293function fetchAuthHeader(provider?: string): string | null {
294 if (provider === 'github') {
295 const token = getGitHubToken();
296 return token ? buildAuthHeader(token) : null;
297 }
298 if (provider === 'gitlab') {
299 const token = getGitLabToken();
300 return token ? buildAuthHeader(token, 'oauth2') : null;
301 }
302 if (provider === 'gitcode') {
303 const token = getGitCodeToken();
304 return token ? buildAuthHeader(token, 'oauth2') : null;
305 }
306 return null;
307}
308
309/**
310 * 在已有 clone 目录上执行 git fetch 并 reset 到最新 HEAD(用于 P5.3 增量;P5.1 暂不调用)。

Callers 1

shallowFetchFunction · 0.85

Calls 4

getGitHubTokenFunction · 0.85
buildAuthHeaderFunction · 0.85
getGitLabTokenFunction · 0.85
getGitCodeTokenFunction · 0.85

Tested by

no test coverage detected