0

I am trying to create an updater using gitpython. But, I am presented with an error when I try to clone into an existing directory.

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2032.0_x64__qbz5n2kfra8p0\lib\tkinter\__init__.py", line 1895, in __call__
    return self.func(*args)
  File "c:\Users\kiyer\Documents\GitHub\SmartRC App\SysBasic.py", line 66, in group
    sysbasic.update.InstallClientUpdate(root, update)
  File "c:\Users\kiyer\Documents\GitHub\SmartRC App\SysBasic.py", line 100, in InstallClientUpdate
    client(window, update)
  File "Sys\Installer.py", line 35, in client
    Repo.clone_from("https://github.com/NoKodaAddictions/File-Database.git", path2)
  File "C:\Users\kiyer\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\git\repo\base.py", line 1032, in clone_from
    return cls._clone(git, url, to_path, GitCmdObjectDB, progress, multi_options, **kwargs)
  File "C:\Users\kiyer\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\git\repo\base.py", line 973, in _clone
    finalize_process(proc, stderr=stderr)
  File "C:\Users\kiyer\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\git\util.py", line 329, in finalize_process
    proc.wait(**kwargs)
  File "C:\Users\kiyer\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\git\cmd.py", line 408, in wait
    raise GitCommandError(self.args, status, errstr)
git.exc.GitCommandError: Cmd('git') failed due to: exit code(128)
  cmdline: git clone -v https://github.com/NoKodaAddictions/File-Database.git C:\Users\kiyer\Documents\GitHub\SmartRC App\
  stderr: 'fatal: destination path 'C:\Users\kiyer\Documents\GitHub\SmartRC App' already exists and is not an empty directory.

How do I use gitpython to clone a repository into a folder that isn't empty?

By the way, I am new to the gitpython module.

phd
  • 82,685
  • 13
  • 120
  • 165
  • It sounds like you're trying to use a Git repository as a software release distribution tool, which is generally not a good idea, since the repository will grow without bound, but your users won't appreciate wasting increasing amounts of space on their disks. – bk2204 Jan 25 '21 at 03:06
  • https://stackoverflow.com/search?q=%5Bgit%5D+clone+into+non-empty+directory – phd Jan 25 '21 at 08:13

2 Answers2

0

The underlying program, git, does not allow this. You can git clone into a temporary location, then mv everything from it into this one.

Ash
  • 73
  • 1
  • 8
0

Although git doesn’t allow this by default, you can’t achieve something similar if you clone it as a bare repo first, then unbare it afterwards followed by a checkout:

git clone --bare https://.... path/to/.git
git config --file path/to/.git/config core.bare false
git -C path/to checkout
AlBlue
  • 23,254
  • 14
  • 71
  • 91