【发布时间】:2015-04-23 09:46:57
【问题描述】:
我安装了 Git Bash 1.9.5。我在 www.github.com 创建了一个仓库。我想从本地计算机上传一个名为 test.txt 的文件到远程 github。我查看了几个旧问题,但找不到解决方法。请帮忙。
我尝试了git add test.txt,然后尝试了git push,但并没有真正奏效。任何帮助将不胜感激。
谢谢
【问题讨论】:
-
您是否完整阅读了 GitHub 教程?如果您这样做了,请提供更多信息,包括您遇到的任何错误。另外:您需要在推送之前提交。
-
“没有真正工作”并不能真正传达命令的输出。
-
在我的电脑中,GitBash 存储库位于 "C:/Users/Sambit/localrepo" 中,我在其中创建了一个名为 "test.txt" 的文本文件。现在来到 GitBash 控制台,我写
cd ~/localrepo来指定我的本地存储库。然后我写git remote add origin "https://github.com/remoteusername/remoterepo",然后我写git add.,然后写git commit -m "add test.txt",上面写着Changes not staged for commit....no changes added to commit",然后git push写着updates were rejected because the remote contains work that you do not have locally...",但我已经克隆了 -
@user3096833 你确定你做了
git clone https://github.com/remoteusername/remoterepo C:/Users/Sambit/localrepo吗?因为如果你做了git clone,你不需要添加遥控器。按照我在下面提到的第二种方法,它会起作用。 -
仍然抛出错误。克隆语句给出错误
destination path already exists and is not an empty directory然后添加语句显示很多警告,最后给出错误:unable to index file...然后fatal : adding files failed