Checkout source files from local git repo to local folder

自古美人都是妖i 提交于 2019-12-08 05:13:41

问题


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

回答1:


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/.



来源:https://stackoverflow.com/questions/18803105/checkout-source-files-from-local-git-repo-to-local-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!