Repository: vscode
Issue: Git - git doesn't find anymore the config from my home which is on a remote server
Labels: bug,git

<!-- ⚠️⚠️ Do Not Delete This! bug_report_template ⚠️⚠️ -->
<!-- Please read our Rules of Conduct: https://opensource.microsoft.com/codeofconduct/ -->
<!-- 🕮 Read our guide about submitting issues: https://github.com/microsoft/vscode/wiki/Submitting-Bugs-and-Suggestions -->
<!-- 🔎 Search existing issues to avoid creating duplicates. -->
<!-- 🧪 Test using the latest Insiders build to see if your issue has already been fixed: https://code.visualstudio.com/insiders/ -->
<!-- 💡 Instead of creating your report here, use 'Report Issue' from the 'Help' menu in VS Code to pre-fill useful information. -->
<!-- 🔧 Launch with `code --disable-extensions` to check. -->
Does this issue occur when all extensions are disabled?: Yes

<!-- 🪓 If you answered No above, use 'Help: Start Extension Bisect' from Command Palette to try to identify the cause. -->
<!-- 📣 Issues caused by an extension need to be reported directly to the extension publisher. The 'Help > Report Issue' dialog can assist with this. -->
- VS Code Version: 1.87.0 (user setup)
- OS Version: Windows_NT x64 10.0.22631
- Node.js: 18.17.1

Steps to Reproduce:

1. Use a user from the domain, which have a home directory in a network drive (Q: in my case)
2. The drive Q:\ has .gitconfig file and .ssh directory. The local directory (c:\users\emmanuel) doesn't.
3. Try to fetch from an existing project (which was working a few days before)
4. Error in the output : 

> Missing or invalid credentials.
> Skip silent fetch commands
> Permission denied, please try again.
> Missing or invalid credentials.
> Skip silent fetch commands
> Permission denied, please try again.
> Missing or invalid credentials.
> Skip silent fetch commands
> git@gitlab.xxxx.xx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
> fatal: Could not read from remote repository.
> 
> Please make sure you have the correct access rights
> and the repository exists.

5. full error :

> > git fetch origin
> c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1
> (()=>{"use strict";var e={4516:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IPCClient=void 0;const t=r(3685);s.IPCClient=class{constructor(e){this.handlerName=e;const s=process.env.VSCODE_GIT_IPC_HANDLE;if(!s)throw new Error("Missing VSCODE_GIT_IPC_HANDLE");this.ipcHandlePath=s}call(e){const s={socketPath:this.ipcHandlePath,path:`/${this.handlerName}`,method:"POST"};return new Promise(((r,n)=>{const o=t.request(s,(e=>{if(200!==e.statusCode)return n(new Error(`Bad status code: ${e.statusCode}`));const s=[];e.on("data",(e=>s.push(e))),e.on("end",(()=>r(JSON.parse(Buffer.concat(s).toString("utf8")))))}));o.on("error",(e=>n(e))),o.write(JSON.stringify(e)),o.end()}))}}},7147:e=>{e.exports=require("fs")},3685:e=>{e.exports=require("http")}},s={};function r(t){var n=s[t];if(void 0!==n)return n.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,r),o.exports}var t={};(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0});const s=r(7147),n=r(4516);function o(e){console.error("Missing or invalid credentials."),console.error(e),process.exit(1)}!function(e){if(!process.env.VSCODE_GIT_ASKPASS_PIPE)return o("Missing pipe");if(!process.env.VSCODE_GIT_ASKPASS_TYPE)return o("Missing type");if("https"!==process.env.VSCODE_GIT_ASKPASS_TYPE&&"ssh"!==process.env.VSCODE_GIT_ASKPASS_TYPE)return o(`Invalid type: ${process.env.VSCODE_GIT_ASKPASS_TYPE}`);if("fetch"===process.env.VSCODE_GIT_COMMAND&&process.env.VSCODE_GIT_FETCH_SILENT)return o("Skip silent fetch commands");const r=process.env.VSCODE_GIT_ASKPASS_PIPE,t=process.env.VSCODE_GIT_ASKPASS_TYPE,i="https"===t?e[2]:e[3];let c,a,p;"https"===t&&(c=e[4].replace(/^["']+|["':]+$/g,"")),"ssh"===t&&(/passphrase/i.test(i)?a=e[6]?.replace(/^["']+|["':]+$/g,""):(c=e[6].replace(/^["']+|["':]+$/g,""),p=e[15])),new n.IPCClient("askpass").call({askpassType:t,request:i,host:c,file:a,fingerprint:p}).then((e=>{s.writeFileSync(r,e+"\n"),setTimeout((()=>process.exit(0)),0)})).catch((e=>o(e)))}(process.argv)})();var n=exports;for(var o in t)n[o]=t[o];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
> 
> TypeError: Cannot read properties of undefined (reading 'replace')
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1748
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1967
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1983
>     at Object.<anonymous> (c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:2089)
>     at Module._compile (node:internal/modules/cjs/loader:1271:14)
>     at Object..js (node:internal/modules/cjs/loader:1326:10)
>     at Module.load (node:internal/modules/cjs/loader:1126:32)
>     at node:internal/modules/cjs/loader:967:12
>     at Function._load (node:electron/js2c/node_init:2:13357)
>     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:96:12)
> 
> Node.js v18.17.1
> Permission denied, please try again.
> c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1
> (()=>{"use strict";var e={4516:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IPCClient=void 0;const t=r(3685);s.IPCClient=class{constructor(e){this.handlerName=e;const s=process.env.VSCODE_GIT_IPC_HANDLE;if(!s)throw new Error("Missing VSCODE_GIT_IPC_HANDLE");this.ipcHandlePath=s}call(e){const s={socketPath:this.ipcHandlePath,path:`/${this.handlerName}`,method:"POST"};return new Promise(((r,n)=>{const o=t.request(s,(e=>{if(200!==e.statusCode)return n(new Error(`Bad status code: ${e.statusCode}`));const s=[];e.on("data",(e=>s.push(e))),e.on("end",(()=>r(JSON.parse(Buffer.concat(s).toString("utf8")))))}));o.on("error",(e=>n(e))),o.write(JSON.stringify(e)),o.end()}))}}},7147:e=>{e.exports=require("fs")},3685:e=>{e.exports=require("http")}},s={};function r(t){var n=s[t];if(void 0!==n)return n.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,r),o.exports}var t={};(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0});const s=r(7147),n=r(4516);function o(e){console.error("Missing or invalid credentials."),console.error(e),process.exit(1)}!function(e){if(!process.env.VSCODE_GIT_ASKPASS_PIPE)return o("Missing pipe");if(!process.env.VSCODE_GIT_ASKPASS_TYPE)return o("Missing type");if("https"!==process.env.VSCODE_GIT_ASKPASS_TYPE&&"ssh"!==process.env.VSCODE_GIT_ASKPASS_TYPE)return o(`Invalid type: ${process.env.VSCODE_GIT_ASKPASS_TYPE}`);if("fetch"===process.env.VSCODE_GIT_COMMAND&&process.env.VSCODE_GIT_FETCH_SILENT)return o("Skip silent fetch commands");const r=process.env.VSCODE_GIT_ASKPASS_PIPE,t=process.env.VSCODE_GIT_ASKPASS_TYPE,i="https"===t?e[2]:e[3];let c,a,p;"https"===t&&(c=e[4].replace(/^["']+|["':]+$/g,"")),"ssh"===t&&(/passphrase/i.test(i)?a=e[6]?.replace(/^["']+|["':]+$/g,""):(c=e[6].replace(/^["']+|["':]+$/g,""),p=e[15])),new n.IPCClient("askpass").call({askpassType:t,request:i,host:c,file:a,fingerprint:p}).then((e=>{s.writeFileSync(r,e+"\n"),setTimeout((()=>process.exit(0)),0)})).catch((e=>o(e)))}(process.argv)})();var n=exports;for(var o in t)n[o]=t[o];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
> 
> TypeError: Cannot read properties of undefined (reading 'replace')
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1748
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1967
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1983
>     at Object.<anonymous> (c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:2089)
>     at Module._compile (node:internal/modules/cjs/loader:1271:14)
>     at Object..js (node:internal/modules/cjs/loader:1326:10)
>     at Module.load (node:internal/modules/cjs/loader:1126:32)
>     at node:internal/modules/cjs/loader:967:12
>     at Function._load (node:electron/js2c/node_init:2:13357)
>     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:96:12)
> 
> Node.js v18.17.1
> Permission denied, please try again.
> c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1
> (()=>{"use strict";var e={4516:(e,s,r)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.IPCClient=void 0;const t=r(3685);s.IPCClient=class{constructor(e){this.handlerName=e;const s=process.env.VSCODE_GIT_IPC_HANDLE;if(!s)throw new Error("Missing VSCODE_GIT_IPC_HANDLE");this.ipcHandlePath=s}call(e){const s={socketPath:this.ipcHandlePath,path:`/${this.handlerName}`,method:"POST"};return new Promise(((r,n)=>{const o=t.request(s,(e=>{if(200!==e.statusCode)return n(new Error(`Bad status code: ${e.statusCode}`));const s=[];e.on("data",(e=>s.push(e))),e.on("end",(()=>r(JSON.parse(Buffer.concat(s).toString("utf8")))))}));o.on("error",(e=>n(e))),o.write(JSON.stringify(e)),o.end()}))}}},7147:e=>{e.exports=require("fs")},3685:e=>{e.exports=require("http")}},s={};function r(t){var n=s[t];if(void 0!==n)return n.exports;var o=s[t]={exports:{}};return e[t](o,o.exports,r),o.exports}var t={};(()=>{var e=t;Object.defineProperty(e,"__esModule",{value:!0});const s=r(7147),n=r(4516);function o(e){console.error("Missing or invalid credentials."),console.error(e),process.exit(1)}!function(e){if(!process.env.VSCODE_GIT_ASKPASS_PIPE)return o("Missing pipe");if(!process.env.VSCODE_GIT_ASKPASS_TYPE)return o("Missing type");if("https"!==process.env.VSCODE_GIT_ASKPASS_TYPE&&"ssh"!==process.env.VSCODE_GIT_ASKPASS_TYPE)return o(`Invalid type: ${process.env.VSCODE_GIT_ASKPASS_TYPE}`);if("fetch"===process.env.VSCODE_GIT_COMMAND&&process.env.VSCODE_GIT_FETCH_SILENT)return o("Skip silent fetch commands");const r=process.env.VSCODE_GIT_ASKPASS_PIPE,t=process.env.VSCODE_GIT_ASKPASS_TYPE,i="https"===t?e[2]:e[3];let c,a,p;"https"===t&&(c=e[4].replace(/^["']+|["':]+$/g,"")),"ssh"===t&&(/passphrase/i.test(i)?a=e[6]?.replace(/^["']+|["':]+$/g,""):(c=e[6].replace(/^["']+|["':]+$/g,""),p=e[15])),new n.IPCClient("askpass").call({askpassType:t,request:i,host:c,file:a,fingerprint:p}).then((e=>{s.writeFileSync(r,e+"\n"),setTimeout((()=>process.exit(0)),0)})).catch((e=>o(e)))}(process.argv)})();var n=exports;for(var o in t)n[o]=t[o];t.__esModule&&Object.defineProperty(n,"__esModule",{value:!0})})();
>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             
> 
> TypeError: Cannot read properties of undefined (reading 'replace')
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1748
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1967
>     at c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:1983
>     at Object.<anonymous> (c:\Users\emmanuel\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\git\dist\askpass-main.js:1:2089)
>     at Module._compile (node:internal/modules/cjs/loader:1271:14)
>     at Object..js (node:internal/modules/cjs/loader:1326:10)
>     at Module.load (node:internal/modules/cjs/loader:1126:32)
>     at node:internal/modules/cjs/loader:967:12
>     at Function._load (node:electron/js2c/node_init:2:13357)
>     at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:96:12)
> 
> Node.js v18.17.1
> git@gitlab.xxxxx.xx: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
> fatal: Could not read from remote repository.
> 
> Please make sure you have the correct access rights
> and the repository exists.
 
6. Try to commit > Error in the output

> 2024-03-04 19:27:26.709 [info] > git -c user.useConfigOnly=true commit --quiet --allow-empty-message --file - [1191ms]
> 2024-03-04 19:27:26.709 [info] Author identity unknown
> 
> *** Please tell me who you are.
> 
> Run
> 
>   git config --global user.email "you@example.com"
>   git config --global user.name "Your Name"
> 
> to set your account's default identity.
> Omit --global to set the identity only in this repository.
> 
> fatal: no email was given and auto-detection is disabled