Using git with synced files with different Windows usernames









up vote
1
down vote

favorite
1












For a particular git repository, I'm using a OneDrive account to keep two Windows 10 machines synced, let's say MachineA and MachineB. Yes I could do the push/pull/merge dance between the two machines, so please don't recommend that. I'm asking about a specific off-label usage of git. I do this because I switch very often when coding at home (back and forth between desk and sofa, depending on kid, wife, dinnertime), and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.



Beyond Compare tells me the files are binary-same, but although I can edit the files and execute my project, I cannot run any git commands on the machine opposite from where the repo was created. Somehow the username is captured in the repository.



For instance, if I had created the repo on MachineA with usernameA, then run any git command on MachineB (having usernameB), I get:



$ git status
fatal: Invalid path 'c:/Users/usernameA': No such file or directory


This failure happens in both directions, depending on where the git repo was created. Git works fine elsewhere on each machine independently, but does not work on the other machine. I'm using using git 2.18.0.windows.1 on one machine and and 2.17.1.windows2 on the other.



I could not find a hard-coded username or user home directory in any human-readable config setting -- global, system, or local to the repo.



I can replicate the problem with a fresh repository, with no files or commits -- just a git init.



If this is a fundamentally not workable usage of git, then I'll change my habits.



If, technically speaking, a binary-same git directory should work on a machine different from where it was created, I'd like to know how to fix this.










share|improve this question





















  • Are u using the same paths on both machines? One Drive store an internal settings as well
    – CodeWizard
    Nov 10 at 22:30














up vote
1
down vote

favorite
1












For a particular git repository, I'm using a OneDrive account to keep two Windows 10 machines synced, let's say MachineA and MachineB. Yes I could do the push/pull/merge dance between the two machines, so please don't recommend that. I'm asking about a specific off-label usage of git. I do this because I switch very often when coding at home (back and forth between desk and sofa, depending on kid, wife, dinnertime), and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.



Beyond Compare tells me the files are binary-same, but although I can edit the files and execute my project, I cannot run any git commands on the machine opposite from where the repo was created. Somehow the username is captured in the repository.



For instance, if I had created the repo on MachineA with usernameA, then run any git command on MachineB (having usernameB), I get:



$ git status
fatal: Invalid path 'c:/Users/usernameA': No such file or directory


This failure happens in both directions, depending on where the git repo was created. Git works fine elsewhere on each machine independently, but does not work on the other machine. I'm using using git 2.18.0.windows.1 on one machine and and 2.17.1.windows2 on the other.



I could not find a hard-coded username or user home directory in any human-readable config setting -- global, system, or local to the repo.



I can replicate the problem with a fresh repository, with no files or commits -- just a git init.



If this is a fundamentally not workable usage of git, then I'll change my habits.



If, technically speaking, a binary-same git directory should work on a machine different from where it was created, I'd like to know how to fix this.










share|improve this question





















  • Are u using the same paths on both machines? One Drive store an internal settings as well
    – CodeWizard
    Nov 10 at 22:30












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





For a particular git repository, I'm using a OneDrive account to keep two Windows 10 machines synced, let's say MachineA and MachineB. Yes I could do the push/pull/merge dance between the two machines, so please don't recommend that. I'm asking about a specific off-label usage of git. I do this because I switch very often when coding at home (back and forth between desk and sofa, depending on kid, wife, dinnertime), and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.



Beyond Compare tells me the files are binary-same, but although I can edit the files and execute my project, I cannot run any git commands on the machine opposite from where the repo was created. Somehow the username is captured in the repository.



For instance, if I had created the repo on MachineA with usernameA, then run any git command on MachineB (having usernameB), I get:



$ git status
fatal: Invalid path 'c:/Users/usernameA': No such file or directory


This failure happens in both directions, depending on where the git repo was created. Git works fine elsewhere on each machine independently, but does not work on the other machine. I'm using using git 2.18.0.windows.1 on one machine and and 2.17.1.windows2 on the other.



I could not find a hard-coded username or user home directory in any human-readable config setting -- global, system, or local to the repo.



I can replicate the problem with a fresh repository, with no files or commits -- just a git init.



If this is a fundamentally not workable usage of git, then I'll change my habits.



If, technically speaking, a binary-same git directory should work on a machine different from where it was created, I'd like to know how to fix this.










share|improve this question













For a particular git repository, I'm using a OneDrive account to keep two Windows 10 machines synced, let's say MachineA and MachineB. Yes I could do the push/pull/merge dance between the two machines, so please don't recommend that. I'm asking about a specific off-label usage of git. I do this because I switch very often when coding at home (back and forth between desk and sofa, depending on kid, wife, dinnertime), and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.



Beyond Compare tells me the files are binary-same, but although I can edit the files and execute my project, I cannot run any git commands on the machine opposite from where the repo was created. Somehow the username is captured in the repository.



For instance, if I had created the repo on MachineA with usernameA, then run any git command on MachineB (having usernameB), I get:



$ git status
fatal: Invalid path 'c:/Users/usernameA': No such file or directory


This failure happens in both directions, depending on where the git repo was created. Git works fine elsewhere on each machine independently, but does not work on the other machine. I'm using using git 2.18.0.windows.1 on one machine and and 2.17.1.windows2 on the other.



I could not find a hard-coded username or user home directory in any human-readable config setting -- global, system, or local to the repo.



I can replicate the problem with a fresh repository, with no files or commits -- just a git init.



If this is a fundamentally not workable usage of git, then I'll change my habits.



If, technically speaking, a binary-same git directory should work on a machine different from where it was created, I'd like to know how to fix this.







git






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 22:13









Sonicsmooth

1,30121225




1,30121225











  • Are u using the same paths on both machines? One Drive store an internal settings as well
    – CodeWizard
    Nov 10 at 22:30
















  • Are u using the same paths on both machines? One Drive store an internal settings as well
    – CodeWizard
    Nov 10 at 22:30















Are u using the same paths on both machines? One Drive store an internal settings as well
– CodeWizard
Nov 10 at 22:30




Are u using the same paths on both machines? One Drive store an internal settings as well
– CodeWizard
Nov 10 at 22:30












2 Answers
2






active

oldest

votes

















up vote
0
down vote



accepted











and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.




You can always commit a "WIP" (Work-In-Progress) on a dedicated draft branch, where you git push --force every time you need to store said work-in-progress.



Regarding the error message, check all the settings with git config -l --show-origin.

Make sure to upgrade first to 2.19.1 and see if the issue persists. (PR 1645 was somehow related to this error)






share|improve this answer




















  • On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
    – Sonicsmooth
    Nov 11 at 11:02










  • I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
    – Sonicsmooth
    Nov 11 at 11:28

















up vote
0
down vote













You store your code under c:usersusername. Move it outside this path (you can use mklink /j to link it to c:usersusername to get it synced). Git uses absolute paths sometime and those abs paths are different on machineA and machineB.






share|improve this answer




















  • So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
    – Sonicsmooth
    Nov 11 at 10:56











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243946%2fusing-git-with-synced-files-with-different-windows-usernames%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted











and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.




You can always commit a "WIP" (Work-In-Progress) on a dedicated draft branch, where you git push --force every time you need to store said work-in-progress.



Regarding the error message, check all the settings with git config -l --show-origin.

Make sure to upgrade first to 2.19.1 and see if the issue persists. (PR 1645 was somehow related to this error)






share|improve this answer




















  • On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
    – Sonicsmooth
    Nov 11 at 11:02










  • I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
    – Sonicsmooth
    Nov 11 at 11:28














up vote
0
down vote



accepted











and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.




You can always commit a "WIP" (Work-In-Progress) on a dedicated draft branch, where you git push --force every time you need to store said work-in-progress.



Regarding the error message, check all the settings with git config -l --show-origin.

Make sure to upgrade first to 2.19.1 and see if the issue persists. (PR 1645 was somehow related to this error)






share|improve this answer




















  • On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
    – Sonicsmooth
    Nov 11 at 11:02










  • I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
    – Sonicsmooth
    Nov 11 at 11:28












up vote
0
down vote



accepted







up vote
0
down vote



accepted







and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.




You can always commit a "WIP" (Work-In-Progress) on a dedicated draft branch, where you git push --force every time you need to store said work-in-progress.



Regarding the error message, check all the settings with git config -l --show-origin.

Make sure to upgrade first to 2.19.1 and see if the issue persists. (PR 1645 was somehow related to this error)






share|improve this answer













and because I don't want to commit half-written code or pollute my history with a zillion trivial commits.




You can always commit a "WIP" (Work-In-Progress) on a dedicated draft branch, where you git push --force every time you need to store said work-in-progress.



Regarding the error message, check all the settings with git config -l --show-origin.

Make sure to upgrade first to 2.19.1 and see if the issue persists. (PR 1645 was somehow related to this error)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 0:53









VonC

821k28425803095




821k28425803095











  • On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
    – Sonicsmooth
    Nov 11 at 11:02










  • I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
    – Sonicsmooth
    Nov 11 at 11:28
















  • On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
    – Sonicsmooth
    Nov 11 at 11:02










  • I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
    – Sonicsmooth
    Nov 11 at 11:28















On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
– Sonicsmooth
Nov 11 at 11:02




On machineA, it tells me that .gitconfig is stored in c:/users/usernameA... so this is finally a clue.
– Sonicsmooth
Nov 11 at 11:02












I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
– Sonicsmooth
Nov 11 at 11:28




I added a folder with the same username and copied the .gitconfig. Kinda kludgey, but it moved the error elsehwere. Now .git/config shows the local drive name in the worktree option under [core]. I won't try to mess with that.
– Sonicsmooth
Nov 11 at 11:28












up vote
0
down vote













You store your code under c:usersusername. Move it outside this path (you can use mklink /j to link it to c:usersusername to get it synced). Git uses absolute paths sometime and those abs paths are different on machineA and machineB.






share|improve this answer




















  • So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
    – Sonicsmooth
    Nov 11 at 10:56















up vote
0
down vote













You store your code under c:usersusername. Move it outside this path (you can use mklink /j to link it to c:usersusername to get it synced). Git uses absolute paths sometime and those abs paths are different on machineA and machineB.






share|improve this answer




















  • So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
    – Sonicsmooth
    Nov 11 at 10:56













up vote
0
down vote










up vote
0
down vote









You store your code under c:usersusername. Move it outside this path (you can use mklink /j to link it to c:usersusername to get it synced). Git uses absolute paths sometime and those abs paths are different on machineA and machineB.






share|improve this answer












You store your code under c:usersusername. Move it outside this path (you can use mklink /j to link it to c:usersusername to get it synced). Git uses absolute paths sometime and those abs paths are different on machineA and machineB.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 1:10









Martin Urbanec

2818




2818











  • So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
    – Sonicsmooth
    Nov 11 at 10:56

















  • So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
    – Sonicsmooth
    Nov 11 at 10:56
















So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
– Sonicsmooth
Nov 11 at 10:56





So strictly speaking, the code on the left is in c:usersusernameAonedrivecompanynamedevclojureprojectname with a symlink to c:dev. On the right it's the same with usernameB and a symlink to c:kdev. I work exclusively in the c:dev and c:kdev linked directories, but the error still refers to the user's home directory where Onedrive likes to live. I'll dig around some more to see if I can find how git may encode originating repository's username.
– Sonicsmooth
Nov 11 at 10:56


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243946%2fusing-git-with-synced-files-with-different-windows-usernames%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

Node.js Script on GitHub Pages or Amazon S3

Museum of Modern and Contemporary Art of Trento and Rovereto