mark safe directory
This commit is contained in:
@@ -40,3 +40,69 @@ Perfect! I've added the git commands to stage all files (`git add .`) and commit
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
_**User**_
|
||||||
|
|
||||||
|
can we also add it as a safe directory? I think this is only happening because it was already added in my git config from testing earlier today
|
||||||
|
|
||||||
|
Enter project name (press Enter for default 'NewProject'):
|
||||||
|
Initialized empty Git repository in //NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject/.git/
|
||||||
|
warning: safe.directory ''*'' not absolute
|
||||||
|
Git LFS initialized.
|
||||||
|
warning: safe.directory ''*'' not absolute
|
||||||
|
fatal: detected dubious ownership in repository at '//NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject'
|
||||||
|
'//NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject' is owned by:
|
||||||
|
(inconvertible) (S-1-5-21-4287411040-2404880660-2766564176-20073)
|
||||||
|
but the current user is:
|
||||||
|
I9KF/Nathan (S-1-5-21-3673805290-2557920245-50210399-1002)
|
||||||
|
To add an exception for this directory, call:
|
||||||
|
|
||||||
|
git config --global --add safe.directory '%(prefix)///NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject'
|
||||||
|
warning: safe.directory ''*'' not absolute
|
||||||
|
fatal: detected dubious ownership in repository at '//NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject'
|
||||||
|
'//NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject' is owned by:
|
||||||
|
(inconvertible) (S-1-5-21-4287411040-2404880660-2766564176-20073)
|
||||||
|
but the current user is:
|
||||||
|
I9KF/Nathan (S-1-5-21-3673805290-2557920245-50210399-1002)
|
||||||
|
To add an exception for this directory, call:
|
||||||
|
|
||||||
|
git config --global --add safe.directory '%(prefix)///NEXUS/amazon/1 Amazon_Active_Projects/3 ProjectStructure/250820_NewProject'
|
||||||
|
Project structure created successfully in folder: 250820_NewProject
|
||||||
|
Press any key to continue . . .
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
_**Assistant**_
|
||||||
|
|
||||||
|
I can see the issue! The script is trying to run git commands on a network path (`//NEXUS/amazon/...`) which is causing ownership/permission issues. We need to add the directory as a safe directory in git config before running the git commands.
|
||||||
|
|
||||||
|
Let me update the script to add the project directory as a safe directory:
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<details><summary>Edit file: NewProject.bat</summary>
|
||||||
|
|
||||||
|
undefined
|
||||||
|
|
||||||
|
**Chunk 1**
|
||||||
|
Lines added: 1, lines removed: undefined
|
||||||
|
|
||||||
|
```diff
|
||||||
|
@@ -61,4 +61,5 @@
|
||||||
|
pushd "%projectRoot%" >nul
|
||||||
|
git init
|
||||||
|
+ git config --global --add safe.directory "%projectRoot%"
|
||||||
|
git lfs install
|
||||||
|
git add . -v
|
||||||
|
```
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Perfect! I've added `git config --global --add safe.directory "%projectRoot%"` right after `git init` and before `git lfs install`. This will add the newly created project directory to git's safe directory list, which should resolve the "dubious ownership" error you're encountering when working with network paths.
|
||||||
|
|
||||||
|
The command will run after the directory is created and git is initialized, ensuring that all subsequent git operations (LFS install, add, and commit) can proceed without ownership warnings.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\components\gitattribute
|
|||||||
:: Initialize git and install Git LFS
|
:: Initialize git and install Git LFS
|
||||||
pushd "%projectRoot%" >nul
|
pushd "%projectRoot%" >nul
|
||||||
git init
|
git init
|
||||||
|
git config --global --add safe.directory "%projectRoot%"
|
||||||
git lfs install
|
git lfs install
|
||||||
git add . -v
|
git add . -v
|
||||||
git commit -m "init"
|
git commit -m "init"
|
||||||
|
|||||||
Reference in New Issue
Block a user