[英]Checkout source files from local git repo to local folder
I am using Amazon Ec2 . 我正在使用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服务器上创建一个远程仓库,可以在其中签入代码并从中运行服务器。
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 我按照此处给出的说明进行操作-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 . 现在,从本地计算机,我将源文件推送到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 . 现在如何将文件从project.git移到项目文件夹。 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. 但是,如果git checkout命令未将变量视为导出,则可以将其包装在脚本中,例如“ 使用post_update
钩子时无法在裸仓库中设置GIT_WORK_TREE
变量 ”。
That is what makes the a post-receive
work, in the directory ~/project.git/hooks/
. 这就是在~/project.git/hooks/
目录中post-receive
工作的原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.