Anyone familiar with Git? I have a very simple question. (Page 1/1)
Patrick OCT 23, 11:30 PM
I've successfully installed Stable Diffusion (which I'll start a thread about once I know what I'm doing), but when I tried to re-open it today, I'm getting a slew of error messages regarding Git and Python. Without going into a lot of detail regarding all of them, could someone please tell me how I'm supposed to deal with the following message...

To add an exception for this directory, call:

git config --global --add safe.directory 'C:/stable diffusion/stable-diffusion-webui/repositories/stable-diffusion'


I don't have a clue where or how I'm supposed to input that command. (I'm running Win7.) When I research this online, the info I find just isn't quite basic enough. It's probably a very simple procedure... but it's all Greek to me!

[This message has been edited by Patrick (edited 10-23-2022).]

Cliff Pennock OCT 24, 10:21 AM
In a CMD window. You are using Windows, so press the Windows + S key, then type "cmd". Right click "Command prompt" (the result that appears) and click "Run as administrator".

In the window that appears, type the git command.
Patrick OCT 24, 03:35 PM
Cliff, thanks for the response. I had actually tried that previously (as it seemed semi-obvious even to a newb like me ), and this is/was the result. What am I doing wrong? Is it because I'm starting off from the default opening of C:\Windows\system32 ? If so, what should it be?

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\Windows\system32>git config --global --add safe.directory 'C:/stable diffusion/stable-diffusion-webui/repositories/stable-diffusion'
error: wrong number of arguments, should be 2
usage: git config [<options>]

Config file location
--global use global config file
--system use system config file
--local use repository config file
--worktree use per-worktree config file
-f, --file <file> use given config file
--blob <blob-id> read config from given blob object

Action
--get get value: name [value-pattern]
--get-all get all values: key [value-pattern]
--get-regexp get values for regexp: name-regex [value-pattern]
--get-urlmatch get value specific for the URL: section[.var] URL
--replace-all replace all matching variables: name value [value-pattern]
--add add a new variable: name value
--unset remove a variable: name [value-pattern]
--unset-all remove all matches: name [value-pattern]
--rename-section rename section: old-name new-name
--remove-section remove a section: name
-l, --list list all
--fixed-value use string equality when comparing values to 'value-pattern'
-e, --edit open an editor
--get-color find the color configured: slot [default]
--get-colorbool find the color setting: slot [stdout-is-tty]

Type
-t, --type <type> value is given this type
--bool value is "true" or "false"
--int value is decimal number
--bool-or-int value is --bool or --int
--bool-or-str value is --bool or string
--path value is a path (file or directory name)
--expiry-date value is an expiry date

Other
-z, --null terminate values with NUL byte
--name-only show variable names only
--includes respect include directives on lookup
--show-origin show origin of config (file, standard input, blob, command line)
--show-scope show scope of config (worktree, local, global, system, command)
--default <value> with --get, use default value when missing entry


C:\Windows\system32>

[This message has been edited by Patrick (edited 10-24-2022).]

williegoat OCT 24, 06:37 PM
Try surrounding the path with double quotes:
code:

git config --global --add safe.directory "C:/stable diffusion/stable-diffusion-webui/repositories/stable-diffusion"



I believe that Windows sees the space after the word "stable" as the end of the pathway and what follows is interpreted as an argument. Double quotes will ensure that the whole string is taken as a pathway.
Patrick OCT 24, 06:58 PM
Okay, I finally got it to work. (I'll mention how a bit later.) If nothing else, I'm persistent.

[EDIT] Oops, didn't see this until after I had posted.


quote
Originally posted by williegoat:

I believe that Windows sees the space after the word "stable" as the end of the pathway and what follows is interpreted as an argument.



Willie, that was indeed part of the issue. I'll elaborate after I have a byte to eat.

[This message has been edited by Patrick (edited 10-24-2022).]

williegoat OCT 24, 07:33 PM
The other two most likely issues would have been file permissions and the directory from which the command was issued.
Patrick OCT 25, 03:41 AM

quote
Originally posted by Patrick:

What am I doing wrong? Is it because I'm starting off from the default opening of C:\Windows\system32 ? If so, what should it be?



Yes, I had to change that, and then add the command, like so...

C:\stable diffusion\stable-diffusion-webui>git config --global --add safe.directory 'C:/stable-diffusion/stable-diffusion-webui/repositories/stable-diffusion'

I found a reference online to a similar problem as I was having, and it was mentioned that there couldn't be any spaces in the command. I had one space, and that was in the name of my folder, "stable diffusion"... so I simply inserted a hyphen, although as you notice above, a hyphen wasn't required in the name of my folder in the location reference to the left.

Willie, out of curiosity, would the double quotes you mentioned have accomplished the same thing as what I did in this instance with the added hyphen?
williegoat OCT 25, 12:39 PM

quote
Originally posted by Patrick:
I found a reference online to a similar problem as I was having, and it was mentioned that there couldn't be any spaces in the command.


Spaces in the command line are not a problem. In fact they are often necessary, as you can see in the command you executed. There are obviously spaces between the command and the options and between the options and their variables.

The problem is the spaces in the pathway.


quote
Originally posted by Patrick:

Willie, out of curiosity, would the double quotes you mentioned have accomplished the same thing as what I did in this instance with the added hyphen?


Although NTFS will allow spaces in filenames (and pathways), it is not a good idea. As you have seen, they can be misinterpreted.
As I said above, double quotes (") will cause windows to take the string as a whole. Another way that will work (sometimes), is to replace the character (the space, in this case) with the appropriate octal character sequence. A space can be replaced by the string "\040".

Patrick OCT 25, 03:02 PM

quote
Originally posted by williegoat:

Spaces in the command line are not a problem....The problem is the spaces in the pathway.



Because I'm a newb at this, I used the wrong terminology... but yes, I understand what you're saying.

Thanks to Cliff and Willie for their input.
theogre OCT 26, 11:02 PM
code:
'C:/stable diffusion/stable-diffusion-webui/repositories/stable-diffusion'
"C:/stable diffusion/stable-diffusion-webui/repositories/stable-diffusion"

This quoting, single or double, is often required in CMD and maybe Power Shell because they can't use Long Names especially ones w/ spaces like in stable diffusion/ above w/o something to "Flag" the text.

Sometimes can use either... Sometime 1 or the other will work because of program only wants one and barf w/o it.

CMD is WinNT and other versions "DOS Emulator" and even after Long Names in Win95, DOS and CMD still defaults 8 chr for directories ans 8.3 for file names.
Way(s) to show the Short and Long Names in files/folders on the media like dir /X

ALSO
Run as Admin is often needed because of UAC. That's even when you are in an Admin Account.

Often Depending on UAC settings, you may need to other programs in Run as Admin mode to setup or all the time... In this case Stable Diffusion, Git and/or Python.
Similar problems w/ PFF's PIP and WinVista and later because how program update itself every time you run it. Most can't run that w/o RaA.

"Depending on UAC settings" Because If UAC and/or User Account is set to lock down more, even RaA may not be enough.
Example: In many work places, you can't install software to can't even set desktop background and screen savers because of Net Controlled Group Polices etc.
UAC = User Account Control

------------------
Dr. Ian Malcolm: Yeah, but your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.
(Jurassic Park)


The Ogre's Fiero Cave