How to solve an error while cloning a github repository - github

I have a repository in github. But I can't clone it. Whenever I try to do so, it says.
fatal: destination path 'repo_name' already exists and is not an empty directory.
before anyone starts saying it is an empty repository, I'm saying it a repository which has files
any answer is appreciated
thank you

This message says that you already have a folder with your project name on the clone destination.
For instance if your GitHub URL is https://github.com/user/myProject.git, by default the clone command will try to create a directory named myProject.
Check the folders of your clone directory or change the name by doing :
git clone https://github.com/user/myProject.git MyNewFolderName

Related

Clone a Git repo using Flutter/Dart

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.
I could do it using this process:
Process.start('cmd', ['/c', 'cd', selectedDirectory, '&', 'git', 'clone', repoLink])
I could not add multiple lines to execute after each other but you can use & to do so for one line commands.

vagrant-Git repository

I'm using vagrant to clone my git repository. I deleted my repository from GitHub my git account. now trying to clone a repository couldn't error message is destination path already exist. how do I delete this already existing path and start afresh?
Similar to this answer, you can:
test if a folder exist (File.directory?(directory))
delete it, using FileUtils.rmdir(disks_directory) (as used in this Vagrant script)

"Not in a git repository" error in git-lfs

I have a over 100 mb csv file that i would like to upload to github using lfs. However, i am facing this issue (Screenshot added). I have put the csv file in the local folder where the repository is located.
enter image description here
You have to init a new repository or clone an existing repository first.
The directory must have a .git folder to be able to run git commands. To create one, run git init and then you would be able to continue.

Creating new git repository, can't add directory

I am about to throw my laptop through a wall, and am hoping for help before reaching that point. For reference, I am following these instructions exactly - https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/.
I have a directory ".../path/thisdir". Inside of thisdir are (1) a file called Demo.R and (2) a directory called sportVU. sportVU is a directory with ~15 files in it.
When I follow the instructions in that link, my github repo looks like this:
https://github.com/NicholasCanova/packageSportVU
Notice that the sportVU directory link cannot be clicked in github, and when I download the repo, sportVU is an empty folder. Why is this happening? This shouldn't be so tough.
EDIT: this is what the repo looks like in my local machine, I'm 100% sure it's not empty:
It could be that you have two .git folder in your directory. View hidden folders to see.
Similar questions:
What does a grey icon in remote GitHub mean
Why can I not open my folder in GitHub?
Since Git doesn't store empty folders the steps you should follow exactly are:
Delete the old repo and start again following exactly my steps.
git clone <repo url>
Inside the folder of the cloned repo create a directory manually and name it as you want i.e sportVU.
Drag and Drop all the files you want in the sportVU direcrory.
cd to Myrepo/sportVU and type git add *
type git commit -m "added some files"
git push -u origin master.
and you should be all set

How to clone github repository to particular folder of hosting without Repository name?

I have my repository on git and it works fine. Repository name is say XXX. Now when i goto my hosting service by connection with SSH and try to clone code with "git clone URL" command in my public_html/ folder, it creates public_html/XXX/. Is there any way by which i can directly get my whole code at public_html/ ?
You could cut your files inside XXX along with the .git file and paste onto your public_html/ folder. Or simply put a . git clone URL .