skip to Main Content

I am having trouble with my GitHub assignment for my school, I’m supposed to clone a repository and push it to a new one that I’ve made but I can’t get past the cloning process.

when I type “git clone file name” is responds with “Fatal: destination path ‘file name’ already exists and is not an empty directory.” I did already try cloning it before and restarting git bash because I kept messing up, maybe it is already cloned then? Any help would be great thank you!

3

Answers


  1. You probably already have a folder in the directory you’re cloning to with the same name as your repo. Try cloning it somewhere else.

    Login or Signup to reply.
  2. The git clone command, you should use the repository’s URL, not just a file name. The correct syntax is git clone [URL of the repository].
    And according to the error it seems that the directory where you’re trying to clone the repository already contains files or the repository itself.
    You can remove the previous repo using rm -rf directory_name and retry the clone command

    Login or Signup to reply.
  3. Could you share more context ? The action you are describing might actually be a "fork" which is a new repository with the content of the first one.

    To "fork", you might open Github and the page of the repository you need to copy, then press the "Fork" button.

    The official documentation might help you if you get troubles : https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo

    Once this is made, you can git clone the repository as yours with the command :

    git clone <repository_url>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search