简体   繁体   English

我已经在计算机上重新安装了Git。 。 。 不能将文件添加到新的本地.git存储库

[英]I have reinstalled Git on my computer . . . and can NOT add files to my new local .git repository

All my JavaScript/Node.js code is working locally on my Windows computer . 我所有的JavaScript / Node.js代码都在Windows计算机上本地运行。 . . and I wanted to deploy my application to Heroku via Github. 我想通过Github将应用程序部署到Heroku。

I installed Git, configured Git, added and comitted all my local files to my local .git repository in my local project folder. 我安装了Git,配置了Git,然后将所有本地文件添加到本地项目文件夹中的本地.git存储库中并提交到其中。 I also signed up for an account on GitHub, created my first remote repository in that account and pushed all my locally comitted files to GitHub. 我还在GitHub上注册了一个帐户,在该帐户中创建了我的第一个远程存储库,并将我所有本地提交的文件推送到GitHub。 When I tried to deploy my application to Heroku via GitHub, the application did not show up in Google Chrome. 当我尝试通过GitHub将应用程序部署到Heroku时,该应用程序未显示在Google Chrome中。

To fix this I DELETED 'Git' in C:\\Program Files\\Git. 为了解决这个问题,我在C:\\ Program Files \\ Git中删除了'Git'。 I also DELETED my local '.git' repository in my local project folder and my remote repository 'my-app' in my account on GitHub . 我还在本地项目文件夹中删除了本地'.git'存储库,并在GitHub帐户中删除了远程存储库'my-app'。 Then I reinstalled Git, configured name, email, default code editor and recreated the folder '.git' in my local project folder with the command 'git init'. 然后,我重新安装了Git,配置的名称,电子邮件,默认代码编辑器,并使用命令“ git init”在本地项目文件夹中重新创建了文件夹“ .git”。

When I now try to add all my updated local files to my new, clean local '.git' repository with the command 'git add -A', I receive the error : 'my-app' does not have a commit checked out - adding files failed. 现在,当我尝试使用命令'git add -A'将所有更新的本地文件添加到新的,干净的本地'.git'存储库时,收到错误消息:'my-app'没有签出提交-添加文件失败。

The 'my-app' is my old, remote repository on GitHub that I have DELETED. “ my-app”是我在GitHub上已删除的旧的远程存储库。 I have created 1 new remote repository on GitHub with the name 'my-new-app'. 我在GitHub上创建了1个新的远程存储库,名称为“ my-new-app”。 Otherwise my account on GitHub is totally clean and updated. 否则,我在GitHub上的帐户完全干净并已更新。

Can you help ? 你能帮我吗 ?

I am using the code editor 'Visual Studio Code' with a bash schell : 我正在使用带有bash schell的代码编辑器“ Visual Studio Code”:

User@workstation00 MINGW64 ~/Project (master) $ git add -A User @ workstation00 MINGW64〜/ Project(master)$ git add -A

..... error: 'natours-app/' does not have a commit checked out - fatal: adding files failed .....错误:“ natours-app /”没有签出提交-致命:添加文件失败

Thanks Wolfeius . 谢谢Wolfeius。 . . I have SOLVED the problem. 我已经解决了这个问题。

When I deleted the old local '.git' repository in my local project folder a NEW folder with the OLD '.git' inside it was automatically created. 当我删除本地项目文件夹中的旧本地“ .git”存储库时,会自动创建一个新文件夹,其中包含旧的“ .git”文件夹。 I did not notice that . 我没有注意到。 . . so when I tried to add all my updated files to my new, fresh '.git' there were two (2) '.git's in my local project folder . 因此,当我尝试将所有更新的文件添加到新的,新的.git中时,本地项目文件夹中有两(2)个.git。 . . and this resulted in the strange error message. 这导致了奇怪的错误消息。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM