I want to do a Process.start('cmd', ['/c', 'git', 'clone', repoLink, selectedDirectory])
in flutter/dart.
My target directory is not empty because when I do a normal git clone, it creates a new folder with the name of the repo an clone inside that.
but when I pass the target folder to git clone
command, it raise an error:
fatal: destination path 'd:\w' already exists and is not an empty directory.
And when i get the repo name and make a directory and add it to selectedDirectory, it would create another folder inside that with the exact same name.like: D:\w\repoName\repoName\[repo files]
So, how can I properly clone a git repo using Process in flutter?
More information:
My target directory is like:
D:\w\
project1\
project2\
...
In a normal clone case, you can simply cd to the target directory D:\w
and do a git clone <repo link>
while the target directory can be not empty.
but when you want to clone that repo while I am in a different path, git gives fatal error:
// git clone <repo-link> <target_folder>
C:\> git clone https://github.com/uesr/repo.git d:\w
fatal: destination path 'd:\w' already exists and is not an empty directory.
I have tried to get the repo name and make a directory and add it to selectedDirectory, but doing that, git clone will create another folder with the repo name.
I want to clone into d:/w/repoName/[repo files]
I would like to do this using Process and work with the actual git software that is installed on the machine.