如何在NitrousIO上将本地文件夹与Git Repository同步 [英] How to sync the local folder with the Git Repository on NitrousIO

查看:107
本文介绍了如何在NitrousIO上将本地文件夹与Git Repository同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先 - 我创建了git仓库,并在本地系统上创建了相同的本地仓库。
Second - 在我的本地系统上工作并做了一些更改,并将更改推送到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 
错误:pathspec'RKsJobs_Board'与git已知的任何文件都不匹配。

我也从下面的实际目录中对Nitrous进行了试用:

  action @ rksrailszone-182221:〜/ RKsJobs_Board $ git checkout  -  RKsJobs_Board 
错误:pathspec'RKsJobs_Board'与任何已知文件去玩。

我知道一些可疑的东西没有找到,但无法找到自己。



让我知道你们是否可以提供帮助。

一个 git init。,本地git仓库是空的,并且没有索引供您签出。

需要添加一个远程repo url

$ p $ g $ git remote add origin / url / to / remote / repo
git fetch
git checkout master origin / master(或)git checkout master&& git reset --hard origin / master

这会为您提供本地远程仓库的内容回购历史记录和工作树。



注意 - 在执行这些步骤之前,请确保已有空文件夹,然后以 git init。和上面提到的其他步骤


First - I've created the git repository and also created the local repo of the same on my local system. Second - Worked on my local system and did some changes and pushed the changes on to the Git repository such that my local system source and git repository are in sync now

Now, Instead of working on my local system, I wanted to work on NitrousIO. Hence created the folder same as my git repository name and did 'git .init' as well. Basically this is the Ruby on Rails application, hence followed 'rails new RKsJobs_Board' to set up the folder and then git .init

What I need is: As the remote git repository is up-to-date with the source code, I would like my NitrousIO folder to be in sync with the remote repository.

How can I achieve this ?

I tried this on Nitrous from the root directory like below:

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

I also tried this on Nitrous from the actual directory like below:

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

I know something fishy is missing to get it work but unable to find out myself.

Let me know if you guys can help..

解决方案

If you just did a git init ., the local git repo is empty and has no index for you to checkout.

You would need to add a remote repo 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

That would give you the content of the remote repo in your local repo history and working tree.

Note - Before following the steps, please ensure to have the empty folder then start with git init . and other steps mentioned above

这篇关于如何在NitrousIO上将本地文件夹与Git Repository同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆