init repo in empty dir

This commit is contained in:
Drake Panzer 2023-01-30 10:38:17 -07:00
parent 8ced0c411f
commit ae57c5b137
No known key found for this signature in database
GPG Key ID: 194A1C358AACFC39
1 changed files with 9 additions and 2 deletions

View File

@ -176,9 +176,16 @@
"repo_storage_dir = Path(repo_storage_dir)\n", "repo_storage_dir = Path(repo_storage_dir)\n",
"stable_diffusion_webui_path = repo_storage_dir / 'stable-diffusion-webui'\n", "stable_diffusion_webui_path = repo_storage_dir / 'stable-diffusion-webui'\n",
"\n", "\n",
"if not (stable_diffusion_webui_path / '.git').exists():\n", "if not (stable_diffusion_webui_path / '.git').exists(): \n",
" # It's possible that the stable_diffusion_webui_path already exists but the repo has not been downloaded.\n",
" # We will init the repo manually.\n",
" !mkdir -p \"{stable_diffusion_webui_path}\"\n", " !mkdir -p \"{stable_diffusion_webui_path}\"\n",
" !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui \"{stable_diffusion_webui_path}\"\n", " %cd \"{stable_diffusion_webui_path}\"\n",
" !git init\n",
" !git remote add origin https://github.com/AUTOMATIC1111/stable-diffusion-webui\n",
" !git fetch\n",
" !git checkout -t origin/master -f\n",
" # !git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui \"{stable_diffusion_webui_path}\"\n",
"else:\n", "else:\n",
" print('stable-diffusion-webui already downloaded, updating...')\n", " print('stable-diffusion-webui already downloaded, updating...')\n",
" !cd \"{stable_diffusion_webui_path}\" && git pull # no % so we don't interfere with the main process\n", " !cd \"{stable_diffusion_webui_path}\" && git pull # no % so we don't interfere with the main process\n",