Git不会将本地存储库与远程存储库同步
问题描述:
我使用GitHub来维护我的项目。我的存储库有问题。它包含一个文件:Git不会将本地存储库与远程存储库同步
public function download($download_path, $download_file) {
file_put_contents($download_path, $download_file);
}
当地的一个样子:
public function download($path, $file) {
file_put_contents($path, $file);
}
虽然当我尝试同步我的本地库与远程一个与git push
它说:
Everything up-to-date
有什么问题? git pull
也不起作用(Already up-to-date.
)
答
我固定它做:
git add .
然后我做:
git commit
它会打开你的默认编辑器,你应该键入提交信息,然后保存并关闭编辑。你会看到类似这样的:
Counting objects: 1, done.
Compressing objects: 100% (1/1), done.
Writing objects: 100% (1/1), 1 bytes, done.
Total 1 (delta 1), reused 0 (delta 0)
To [email protected]:user/repository.git
9a4v59c..146v3qz master -> master
然后我做了git pull
& git push
。
答
看起来你还没有在本地提交你的修改。
-
阶段修改后的文件:
git add path/to/the-file
-
本地提交更改:
git commit
-
把你的改变GitHub上。假设你的GitHub的远程调用
origin
:git push origin master
你可能要考虑读一个Git教程。这里是Atlassian's tutorials,这里是GitHub's interactive tutorial。
您是否在本地提交了更改? – Chris 2014-08-29 14:44:02
@Chris我该怎么做? – 2014-08-29 15:23:31
取决于您使用的工具。在命令行中,像'git add the-file','git commit'。你说“我使用GitHub来维护我的项目”,但这实际上是Git所做的最基本的事情。也许你需要阅读教程? – Chris 2014-08-29 15:45:32