从本地的git回购本地​​文件夹结帐源文件 [英] Checkout source files from local git repo to local folder

查看:196
本文介绍了从本地的git回购本地​​文件夹结帐源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Amazon EC2上。我试图创建EC2服务器,我可以为您在code,并从那里运行我的服务器上的远程回购。

EC2服务器

下面是创建两个文件夹

  /home/ubuntu/project.git< ----回购
/主页/ Ubuntu的/项目< ----源文件来运行服务器
 

我也跟着在这里给出的说明 - 的http://blog.soarez.com/post/56644329478/deploy-a-node-js-service-on-ec2-with-git

现在从我的本地计算机上,我把源文件project.git。它工作正常。文件将被推入回购。

现在我怎么从project.git到项目文件夹获取文件。 我想这样做,但它不工作 -

  CD〜/ project.git
GIT_WORK_TREE = /家庭/ Ubuntu的/项目的git结算-f
 

解决方案

  CD〜/ project.git
GIT_WORK_TREE = /家庭/ Ubuntu的/项目的git结算-f
 

这是正确的方式从href="http://gitolite.com/concepts/bare.html" rel="nofollow">裸回购一个

但是,如果变量没有被看到的由git的checkout命令输出,你可以用,在一个剧本,如无法设置 GIT_WORK_TREE 时使用纯仓库变量 post_update 挂钩做到了。
这是什么使一个后收到工作,在目录〜/ project.git /钩/

I am using Amazon Ec2 . I am trying to create a Remote Repo on the Ec2 server to which I can check in code and run my server from there .

Ec2 Server

Here is created two folders

/home/ubuntu/project.git <---- Repo
/home/ubuntu/project     <---- Source files to run server

I followed the instructions given here - http://blog.soarez.com/post/56644329478/deploy-a-node-js-service-on-ec2-with-git

Now from my local computer , I pushed the source files to project.git . It works fine . Files get pushed into the repo.

Now how do I get the files from the project.git to the project folder . I tried doing this , but it doesnt work -

cd ~/project.git
GIT_WORK_TREE=/home/ubuntu/project git checkout -f

解决方案

cd ~/project.git
GIT_WORK_TREE=/home/ubuntu/project git checkout -f

This is the right way to checkout files from a bare repo.

But if the variable isn't see as exported by the git checkout command, you can wrap that in a script, like "unable to set GIT_WORK_TREE variable in a bare repository when using post_update hook" did.
That is what makes the a post-receive work, in the directory ~/project.git/hooks/.

这篇关于从本地的git回购本地​​文件夹结帐源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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