简体   繁体   English

为什么 Android Studio 中的“提交”按钮是灰色的?

[英]Why's the button “Commit” greyed out in Android Studio?

I want to commit my changes to my project to GitHub but for some reason, the "Commit" button is greyed out in Android Studio .我想将我对项目的更改提交到GitHub但由于某种原因,“提交”按钮在Android Studio显示为灰色。 I can't seem to spot what's causing this issue.我似乎无法发现导致此问题的原因。 Even when I write a message, it's still greyed out.即使我写了一条消息,它仍然是灰色的。

How would I fix this?我将如何解决这个问题?

灰色按钮的图像

You have to make sure those files are blue (or green if new files).您必须确保这些文件是蓝色的(如果是新文件,则为绿色)。 Hit Cancel, go back out to the app.点击取消,返回应用程序。 Right click app at the top and goo down to git then add all.右键单击顶部的应用程序,然后转到 git,然后添加所有内容。 That will add all of them.这将添加所有这些。 Then, you will be able to commit and push your changes.然后,您将能够提交和推送您的更改。 However, you also need to make sure you click on the checkbox.但是,您还需要确保单击了复选框。

Add files you want to commit:添加要提交的文件:

git add <file_name>

or to add all of them:或添加所有这些:

git add .

Commit files (using IDE or console - for now button should be active):提交文件(使用 IDE 或控制台 - 现在按钮应该处于活动状态):

git commit -m "message"

Commit files using IDE - remember add message to commit使用 IDE 提交文件 - 记住添加要提交的消息

If there are files with red color mean you have not added them to git.如果有红色文件,则表示您尚未将它们添加到 git。 Right click on the file->Git->add右键单击文件-> Git->添加

Then you can commits the changes.然后您可以提交更改。

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

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