简体   繁体   English

从本地git repo签出源文件到本地文件夹

[英]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服务器上创建一个远程仓库,可以在其中签入代码并从中运行服务器。

Ec2 Server 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.

相关问题 如何从git repo在我的本地计算机(Windows 8)中检出项目,而我正在使用bitbuket和源代码树 - How to checkout project in my local machine(windows 8) from git repo and i am using bitbuket & source tree 从本地文件夹创建远程 git repo - Create a remote git repo from local folder 使用 GIT 通过拖放方法替换连接到 Azure Devops(Web)的源/存储库文件夹(本地)中的文件 - Replacing files in source/repo folder (local) connected to Azure Devops (web) using GIT via drag and drop method 从本地 git repo 中恢复已删除的文件? - Recover deleted files from local git repo? 在 BitBucket 存储库中托管可执行的 .jar 文件或自动将可执行的 .jar 文件从 git 打包到本地文件夹 - Hosting executable .jar files in BitBucket repo or automate packaging executable .jar files from git into local folder git checkout其他用户的本地仓库 - Git checkout another user's local repo 理解使用本地仓库的“git checkout” - Understanding of "git checkout" working with local repo 从本地.git文件夹恢复Git历史记录/回购 - Restore Git History / Repo From Local .git Folder 运行“git checkout origin/main”后意外从本地文件夹中删除了文件 - Accidently removed files from local folder after running "git checkout origin/main" Git 状态和本地 repo 文件 - Git status and local repo files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM