git 如何从cloud9推送到github?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7355277/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to push to github from cloud9?
提问by JohnIdol
I am trying to push some changes from cloud9 to a github repository but I am hitting a roadblock.
我正在尝试将一些更改从 cloud9 推送到 github 存储库,但遇到了障碍。
I can clone OK with ssh, and everything seems to be OK, I make my changes, save the changes in cloud9 (when I go back the changes are still there), then I do git commit
and get:
我可以用 ssh 克隆 OK,一切似乎都没有问题,我进行了更改,将更改保存在 cloud9 中(当我返回时,更改仍然存在),然后我执行git commit
并得到:
no changes added to commit (use "git add" and/or "git commit -a")
but I just need to commit changes to an existing file not to add. So obviously when I try to git push origin master
there's nothing to push.
但我只需要提交对现有文件的更改而不是添加。所以很明显,当我尝试时,git push origin master
没有什么可以推动的。
I tried with multiple github repos and I get the same result.
我尝试了多个 github 存储库,但得到了相同的结果。
What am I missing?
我错过了什么?
Any help appreciated!
任何帮助表示赞赏!
P.S. Oh, btw I suck at git
PS哦,顺便说一句,我很讨厌git
回答by Sarfraz
The message shows that you are not adding changed/tracked files to commit.
该消息显示您没有添加要提交的更改/跟踪文件。
Try with -am
switch to ADD and Commit in one operation:
尝试-am
在一个操作中切换到 ADD 和 Commit:
git commit -am "your message goes here"
git push
回答by knittl
Git separates committing from adding changes. You first have to add all changes you want to appear in the commit:
Git 将提交与添加更改分开。您首先必须添加要出现在提交中的所有更改:
#1: Add any new files as part of the commit
# or use git add -p to interactively select hunks to stage
git add file1 file2 …
#2: Commit to local
git commit -m "Commit message goes here"
#3: Push your commit/changes to the host (github)
git push
You should now have all your changes on github.
您现在应该在 github 上拥有所有更改。
Alternatively, you can do the commit, and add/modify in one line, this may include undesired files into your changeset.
或者,您可以进行提交,并在一行中添加/修改,这可能会将不需要的文件包含到您的变更集中。
#1 Add files commit to local
git commit -a -m "Commit message goes here"
#2 Push your commit/messages to the host (github)
git push