如何将本地文件夹与 NitrousIO 上的 Git 存储库同步

How to sync the local folder with the Git Repository on NitrousIO

首先 - 我已经创建了 git 存储库,还在我的本地系统上创建了相同的本地存储库。 其次 - 在我的本地系统上工作并进行了一些更改并将更改推送到 Git 存储库,以便我的本地系统源和 git 存储库现在同步

现在,我不想在本地系统上工作,而是想在 NitrousIO 上工作。因此创建了与我的 git 存储库名称相同的文件夹,并且也创建了 'git .init'。基本上这是 Ruby on Rails 应用程序,因此遵循 'rails new RKsJobs_Board' 设置文件夹,然后 git .init

我需要的是: 由于远程 git 存储库是最新的源代码,我希望我的 NitrousIO 文件夹与远程存储库同步。

我怎样才能做到这一点?

我在 Nitrous 上从根目录尝试了这个,如下所示:

action@rksrailszone-182221:~$ git checkout -- RKsJobs_Board                                                                                                                                           
error: pathspec 'RKsJobs_Board' did not match any file(s) known to git.

我也在 Nitrous 上从下面的实际目录中尝试了这个:

action@rksrailszone-182221:~/RKsJobs_Board$ git checkout -- RKsJobs_Board                                                                                                                             
error: pathspec 'RKsJobs_Board' did not match any file(s) known to git. 

我知道它缺少一些可疑的东西来让它工作但无法找到我自己。

如果你们能帮上忙,请告诉我..

如果您刚刚执行了 git init .,本地 git 存储库是空的,没有可供您检查的索引。

您需要添加一个远程仓库 url

git remote add origin /url/to/remote/repo
git fetch
git checkout master origin/master (or) git checkout master && git reset --hard origin/master

这会在您的本地回购历史和工作树中为您提供远程回购的内容。

注意-在执行这些步骤之前,请确保有空文件夹,然后从git init .和上述其他步骤开始