开发者

Pushing a local git repo to another online git repos (like github)

开发者 https://www.devze.com 2023-01-28 06:40 出处:网络
I have a repo on my computer that I want to push to a test environment online, so on my online server I installed git, created a repo and everything,

I have a repo on my computer that I want to push to a test environment online, so on my online server I installed git, created a repo and everything,

I can currently push to the repo and it work, but.. I can't find my applications files, there is only git files in the folder, what do I need to do开发者_C百科 to get my test environment working where I can push to it.


Nominally, the right way to do this in Git is to push your code to a stable location (e.g., github) and then have the online server "pull" from that location.

When you push in Git, git does not update the working tree, only the repository history. By default, you are even prevented from pushing to a repository with a working directory (whose HEAD matches the branch you are pushing to).

However, it is certainly possible to configure Git to allow you to do something like what you want. See http://toroid.org/ams/git-website-howto for details on how to configure an external work-tree and post-receive-hook to automatically update that external work tree when you push.

You might also want to use a tool like Capistrano http://help.github.com/capistrano/ to help you with the deploy.


Sounds like you cloned a bare repository. If you did clone without the "--bare" option, you may be on a different branch.

0

精彩评论

暂无评论...
验证码 换一张
取 消