繁体   English   中英

git commit到远程存储库不起作用

[英]git commit to remote repository not working

不明白为什么我对远程git repo的提交无法正常工作。

所以我从远程仓库中克隆了一个分支

git clone -b MYBRANCH git@172.27.1.111:/home/my.git

我修改了一个名为test的文件

git diff shows the change

diff --git a/test b/test
index e69de29..9ccc327 100644
--- a/test
+++ b/test
@@ -0,0 +1,3 @@
+changed.
+
+

当我提交时,没有任何更改添加到提交中。

git commit -m "changed the test file"
# On branch MCKINLEY
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   modified:   test
#
no changes added to commit (use "git add" and/or "git commit -a")

我在这里想念什么?

您需要将其添加到索引。

git add test

猜测您可能是git的新手。在这里查看索引的简介。

该消息不是告诉您该怎么做吗?

git add test

请注意, git add不仅可以添加新文件,还可以对现有文件进行添加/登台修改

我建议尝试使用git status来查看是否需要添加文件。

git status

如果仍然需要向提交中添加文件,则可以执行git add。 或git add

git add .

然后您的提交就可以开始了

git commit -a

希望有帮助!

暂无
暂无

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

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