{"thread":{"id":"54297","subject":"Git Alias not working in worktree","startedAt":"2020-09-25T16:44:30Z","lastAt":"2020-10-22T19:26:11Z","messageCount":6,"participants":["Frank Illenseer","brian m. carlson","Eric Sunshine","Randall S. Becker"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"406348","messageId":"DM5PR03MB2826C04CC5AAF3B61BDDAFE2B5360@DM5PR03MB2826.namprd03.prod.outlook.com","threadId":"54297","inReplyTo":"DM5PR03MB2826A616AC30710E169B7237B5360@DM5PR03MB2826.namprd03.prod.outlook.com","subject":"Git Alias not working in worktree","fromName":"Frank Illenseer","fromEmail":"illenseer@altair.de","sentAt":"2020-09-25T16:44:25Z","receivedAt":"2020-09-25T16:44:30Z","isPatch":false,"sender":{"key":"illenseer@altair.de","avatar":null},"body":"Dear Git User-group,\n\nI am having a setup where I use worktrees and I was now experimenting with adding git aliases to work more efficiently with the commands.\nHowever I found that obviously it does not seem to work like I would like to have it:\n\nMy intention is to have a \".gitconfig\" file as part of the repo so that all developers can easily get to the same configuration that was setup and also to have the config tracked as part of the repo.\nWe are using Git for Windows v2.28 and also git 2.28 on Linux.\n\nI printed my config from my windows machine below.\nYou will also see that I have two aliases defined now at two places:\n-  The \"sts\" alias in an include file from my personal .gitconfig ni my HOME\n-  The \"st\" alias in the include file that is part of the repository which is included in the config of the worktree\n\nOnly the \"sts\" alias is recognized by git and works, while the \"st\" is unknown.\nBut both of the aliases show equally in the below \"git config -list\".\n\nWHY is the one working and the other one not!\nHOW can I get both working equally?\n\nAny hints or help is greatly appreciated.\nThanks and best regards,\nFrank\n\n\nme@MYPC /c/WORK/my_src/wt_KER-dev-B (Features/2.1/gitUtilities|SPARSE)\n$ git config --list --show-origin\nfile:D:/Programs/GitForWindows/etc/gitconfig    http.sslcainfo=D:/Programs/GitForWindows/mingw64/ssl/certs/ca-bundle.crt\nfile:D:/Programs/GitForWindows/etc/gitconfig    http.sslbackend=openssl\nfile:D:/Programs/GitForWindows/etc/gitconfig    diff.astextplain.textconv=astextplain\nfile:D:/Programs/GitForWindows/etc/gitconfig    filter.lfs.clean=git-lfs clean -- %f\nfile:D:/Programs/GitForWindows/etc/gitconfig    filter.lfs.smudge=git-lfs smudge -- %f\nfile:D:/Programs/GitForWindows/etc/gitconfig    filter.lfs.process=git-lfs filter-process\nfile:D:/Programs/GitForWindows/etc/gitconfig    filter.lfs.required=true\nfile:D:/Programs/GitForWindows/etc/gitconfig    credential.helper=manager\nfile:D:/Programs/GitForWindows/etc/gitconfig    core.autocrlf=true\nfile:D:/Programs/GitForWindows/etc/gitconfig    core.fscache=true\nfile:D:/Programs/GitForWindows/etc/gitconfig    core.symlinks=false\nfile:D:/Programs/GitForWindows/etc/gitconfig    pull.rebase=false\nfile:C:/Users/myaccount/.gitconfig       user.name=My Name\nfile:C:/Users/myaccount/.gitconfig       mailto:user.email=me@comp.de\nfile:C:/Users/myaccount/.gitconfig       receive.denycurrentbranch=updateInstead\nfile:C:/Users/myaccount/.gitconfig       include.path=.gitconfig.aliases\nfile:C:/Users/myaccount/.gitconfig.aliases       alias.sts=status -s\nfile:C:/WORK/my_src/_MAIN/.git/config core.repositoryformatversion=1\nfile:C:/WORK/my_src/_MAIN/.git/config core.filemode=false\nfile:C:/WORK/my_src/_MAIN/.git/config core.bare=false\nfile:C:/WORK/my_src/_MAIN/.git/config core.logallrefupdates=true\nfile:C:/WORK/my_src/_MAIN/.git/config core.ignorecase=true\nfile:C:/WORK/my_src/_MAIN/.git/config core.symlinks=true\nfile:C:/WORK/my_src/_MAIN/.git/config core.longpaths=true\nfile:C:/WORK/my_src/_MAIN/.git/config mailto:remote.origin.url=git@gitlab.xyz.com:project.git\nfile:C:/WORK/my_src/_MAIN/.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*\nfile:C:/WORK/my_src/_MAIN/.git/config branch.master.remote=origin\nfile:C:/WORK/my_src/_MAIN/.git/config branch.master.merge=refs/heads/master\nfile:C:/WORK/my_src/_MAIN/.git/config extensions.worktreeconfig=true\nfile:C:/WORK/my_src/_MAIN/.git/config fetch.prune=true\nfile:C:/WORK/my_src/_MAIN/.git/config fetch.prunetags=true\nfile:C:/WORK/my_src/_MAIN/.git/worktrees/wt_KER-dev-B/config.worktree include.path=C:/WORK/my_src/wt_KER-dev-B/.gitconfig\nfile:C:/WORK/my_src/wt_KER-dev-B/.gitconfig   core.hookspath=devops/git/hooks\nfile:C:/WORK/my_src/wt_KER-dev-B/.gitconfig   core.longpaths=true\nfile:C:/WORK/my_src/wt_KER-dev-B/.gitconfig   extensions.worktreeconfig=true\nfile:C:/WORK/my_src/wt_KER-dev-B/.gitconfig   fetch.prune=true\nfile:C:/WORK/my_src/wt_KER-dev-B/.gitconfig   fetch.prunetags=true\nfile:C:/WORK/my_src/wt_KER-dev-B/.gitconfig   alias.st=status\nfile:C:/WORK/my_src/_MAIN/.git/worktrees/wt_KER-dev-B/config.worktree core.sparsecheckout=true\n\nme@MYPC /c/WORK/my_src/wt_KER-dev-B (Features/2.1/gitUtilities|SPARSE)\n$ git st\ngit: 'st' is not a git command. See 'git --help'.\n\nThe most similar commands are\n        status\n        sts\n\nme@MYPC /c/WORK/my_src/wt_KER-dev-B (Features/2.1/gitUtilities|SPARSE)\n$ git sts\nM .gitconfig\nM devops/python/modules/gitUtilities.py\n\n\n"},{"id":"406408","messageId":"20200925222801.GC1392312@camp.crustytoothpaste.net","threadId":"54297","inReplyTo":"DM5PR03MB2826C04CC5AAF3B61BDDAFE2B5360@DM5PR03MB2826.namprd03.prod.outlook.com","subject":"Re: Git Alias not working in worktree","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-09-25T22:28:01Z","receivedAt":"2020-09-25T22:28:38Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-09-25 at 16:44:25, Frank Illenseer wrote:\n> Dear Git User-group,\n> \n> I am having a setup where I use worktrees and I was now experimenting with adding git aliases to work more efficiently with the commands.\n> However I found that obviously it does not seem to work like I would like to have it:\n> \n> My intention is to have a \".gitconfig\" file as part of the repo so that all developers can easily get to the same configuration that was setup and also to have the config tracked as part of the repo.\n> We are using Git for Windows v2.28 and also git 2.28 on Linux.\n\nI'm not sure about what's causing the issue that you're having, but let\nme dissuade you from trying to store configuration in the repository.\nGit's security model doesn't permit untrusted configuration because\nconfiguration can be used to specify programs and execute arbitrary\ncode.  If you specify a config file that's in the repository and someone\nchecks out a branch with a malicious config file, they can execute\narbitrary code on that system.\n\nIf you want to provide settings, it would be better to provide a shell\nscript that developers could _optionally_ run (after first verifying)\nthat sets certain config options.  Because that would be run only on\ndemand by the user and can be inspected before running, it would be a\nlot more secure.  In addition, if you're setting aliases, it's possible\nthat the user may already have an alias for that option that they are\nused to and expect to work a certain way (e.g., my \"git co\" is\nrecursive) and may not want your alias.\n\nI realize you may be working in a corporate environment where users are\nsomewhat more trusted, but take note that you probably don't let\ndevelopers execute arbitrary code on each other's systems and social\nengineering attacks (\"Hey, can you check out this branch and see why the\ncode isn't working?\") are easy.  There's a big difference between \"I\nran this script\" and \"I checked out this branch\".\n\nHopefully someone else can provide an answer to why your alias isn't\nworking.  I have some guesses, but no definitive answers at the moment.\nI'll try to play around with some things and figure it out over the next\ncouple of days if nobody gets to it before me.\n-- \nbrian m. carlson: Houston, Texas, US\n"},{"id":"407067","messageId":"DM5PR03MB28262362A9D3B0EDECBE6106B50A0@DM5PR03MB2826.namprd03.prod.outlook.com","threadId":"54297","inReplyTo":"20200925222801.GC1392312@camp.crustytoothpaste.net","subject":"RE: Git Alias not working in worktree","fromName":"Frank Illenseer","fromEmail":"illenseer@altair.de","sentAt":"2020-10-07T15:51:15Z","receivedAt":"2020-10-07T15:51:18Z","isPatch":false,"sender":{"key":"illenseer@altair.de","avatar":null},"body":"Thanks, Brian for your comments and input. - Definitely a good input and always good to keep security high-up in view!\nHowever in the secure corporate environment and with a lot of developers (not always doing what they are requested), the need to \"enforce\" something is more emerging...\n\nThus I would like to re-iterate the question and ask for your suspicions (as you mentioned you might have some) and/or others, if anyone can see why this is not working as I was assuming it to work...\n\nThanks and best regards,\nFrank\n"},{"id":"408164","messageId":"DM5PR03MB2826382CD1A5AA8F3ED60FD9B51D0@DM5PR03MB2826.namprd03.prod.outlook.com","threadId":"54297","inReplyTo":"DM5PR03MB28262362A9D3B0EDECBE6106B50A0@DM5PR03MB2826.namprd03.prod.outlook.com","subject":"RE: Git Alias not working in worktree","fromName":"Frank Illenseer","fromEmail":"illenseer@altair.de","sentAt":"2020-10-22T12:06:00Z","receivedAt":"2020-10-22T12:06:04Z","isPatch":false,"sender":{"key":"illenseer@altair.de","avatar":null},"body":"Hi All,\n\nDoes anyone have any idea as to why the alias definitions from the config of a worktree is not working? - I would still be interested in a solution to get this working.\n\nThanks and best regards,\nFrank\n"},{"id":"408183","messageId":"CAPig+cSbUjb0=TRGdpdTV9XyVbRad-f-_Ypw72wVE0OBR6TaQg@mail.gmail.com","threadId":"54297","inReplyTo":"DM5PR03MB2826382CD1A5AA8F3ED60FD9B51D0@DM5PR03MB2826.namprd03.prod.outlook.com","subject":"Re: Git Alias not working in worktree","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2020-10-22T19:06:39Z","receivedAt":"2020-10-22T19:06:55Z","isPatch":false,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Oct 22, 2020 at 8:06 AM Frank Illenseer <illenseer@altair.de> wrote:\n> Does anyone have any idea as to why the alias definitions from the\n> config of a worktree is not working? - I would still be interested\n> in a solution to get this working.\n\nFor reference, the original question was posted in[1], and brian\nmentioned[2] that he would take a look at it. brian, did happen to\ninvestigate this at all?\n\n[1]: https://lore.kernel.org/git/DM5PR03MB2826C04CC5AAF3B61BDDAFE2B5360@DM5PR03MB2826.namprd03.prod.outlook.com/\n[2]: https://lore.kernel.org/git/20200925222801.GC1392312@camp.crustytoothpaste.net/\n"},{"id":"408186","messageId":"005c01d6a8a9$2b7007b0$82501710$@nexbridge.com","threadId":"54297","inReplyTo":"CAPig+cSbUjb0=TRGdpdTV9XyVbRad-f-_Ypw72wVE0OBR6TaQg@mail.gmail.com","subject":"RE: Git Alias not working in worktree","fromName":"Randall S. Becker","fromEmail":"rsbecker@nexbridge.com","sentAt":"2020-10-22T19:25:52Z","receivedAt":"2020-10-22T19:26:11Z","isPatch":false,"sender":{"key":"randall.becker@nexbridge.ca","avatar":"https://avatars.githubusercontent.com/u/28956764?v=4"},"body":"On October 22, 2020 3:07 PM, Eric Sunshine wrote:\n> To: Frank Illenseer <illenseer@altair.de>\n> Cc: git@vger.kernel.org\n> Subject: Re: Git Alias not working in worktree\n> \n> On Thu, Oct 22, 2020 at 8:06 AM Frank Illenseer <illenseer@altair.de> wrote:\n> > Does anyone have any idea as to why the alias definitions from the\n> > config of a worktree is not working? - I would still be interested in\n> > a solution to get this working.\n> \n> For reference, the original question was posted in[1], and brian\n> mentioned[2] that he would take a look at it. brian, did happen to investigate\n> this at all?\n> \n> [1]:\n> https://lore.kernel.org/git/DM5PR03MB2826C04CC5AAF3B61BDDAFE2B536\n> 0@DM5PR03MB2826.namprd03.prod.outlook.com/\n> [2]:\n> https://lore.kernel.org/git/20200925222801.GC1392312@camp.crustytooth\n> paste.net/\n\nDoes the alias work in your main working directory and but not in the worktree? I'm trying to figure out how you would specify a worktree-specific alias in the first place since it is shared with all worktrees of the main clone.\n\nRegards,\nRandall\n\n-- Brief whoami:\n NonStop developer since approximately 211288444200000000\n UNIX developer since approximately 421664400\n-- In my real life, I talk too much.\n\n\n\n"}]}