1

So I'm following this tutorial: https://www.techwithtim.net/tutorials/discord-py/hosting-a-discord-bot-for-free/ and I was getting this error:

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>git add .
warning: LF will be replaced by CRLF in MyPythonFolder/Discord/.idea/inspectionProfiles/Project_Default.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in MyPythonFolder/Discord/.idea/inspectionProfiles/profiles_settings.xml.
The file will have its original line endings in your working directory
error: 'MyPythonFolder/Discord/among-us-bot1234/' does not have a commit checked out
fatal: adding files failed

after I ran the code:

git add .

Here is my full cmd:

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>heroku login
heroku: Press any key to open up the browser to login or q to exit:
Opening browser to https://cli-auth.heroku.com/auth/cli/browser/fa74f932-feb1-48cc-af29-1ab8f995ff9f?requestor=SFMyNTY.g2gDbQAAAAw2OC4xOTYuODMuOTVuBgC2ut1PdgFiAAFRgA.KdgYZdPy5IkEVNVbkS1q23B2LkB-Jo93XT9vBCojPvs
Logging in... done
Logged in as pytthon.joshua@gmail.com

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>heroku git:clone -a among-us-bot1234
fatal: destination path 'among-us-bot1234' already exists and is not an empty directory.

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>heroku git:clone -a among-us-bot1234
Cloning into 'among-us-bot1234'...
warning: You appear to have cloned an empty repository.

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>git add .
warning: LF will be replaced by CRLF in MyPythonFolder/Discord/.idea/inspectionProfiles/Project_Default.xml.
The file will have its original line endings in your working directory
warning: LF will be replaced by CRLF in MyPythonFolder/Discord/.idea/inspectionProfiles/profiles_settings.xml.
The file will have its original line endings in your working directory
error: 'MyPythonFolder/Discord/among-us-bot1234/' does not have a commit checked out
fatal: adding files failed

any help would be appreciated

WinstonMan
  • 132
  • 1
  • 13

1 Answers1

1

Let's break down your errors one by one:

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>heroku git:clone -a among-us-bot1234
fatal: destination path 'among-us-bot1234' already exists and is not an empty directory.

you are cloning in a directory which is not empty. This is a bad idea: clone your repository into a new, empty folder. Git won't let you clone in that directory anyway.

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>heroku git:clone -a among-us-bot1234
Cloning into 'among-us-bot1234'...
warning: You appear to have cloned an empty repository.

I assume you deleted your folder among-us-bot1234 and cloned into it. Now that the folder is empty, the clone will be completed successfully. However, the remote repository is empty: there are no files in it.

C:\Users\Joshua\OneDrive\VscodePrograms\MyPythonFolder\Discord>git add .
[...]
error: 'MyPythonFolder/Discord/among-us-bot1234/' does not have a commit checked out
fatal: adding files failed

Let us ignore the warnings on line ending for a minute, they are irrelevant. The does not have a commit checked out is extensively discussed in this other question. The gist of it is: do not clone in a not-empy folder. If, for instance, you end up with nested .git folders, that is to say with nested local git repositories, this error might occour.

Go back to the tutorial, follow it, but clone into a local folder that is empty. Git will create the folder for you if it doesn't exists. Your local folder needn't share the same name as the repository.

do you have nested git repositories? Yes you do. C:\Users\<yourname>\OneDrive\VscodePrograms\MyPythonFolder\Discord appears to be a git repository (root or subfolder of one). You cloned something inside it in [...]\Discord\among-us-bot1234. You now have multiple nested git repositories, and that is to be managed. In your case, by not cloning inside an existing repository.

Daemon Painter
  • 3,208
  • 3
  • 29
  • 44