Git: Different Working Directory and Repository lo

2019-08-13 19:14发布

I made a home server where i'm using Git on a website I'm doing. I created a git on that home server, but I'm editing the files from another computer remotely connecting to it, and using an IDE(Eclipse+Egit) I'm using it. but its kinda slow.

So is there a way to get my repository on my own system, but the actual working directory to the server?

Currently my server git is on

Z:/sites/my_site/.git

I want my git to be on:

C:/git/my_site/.git

but still work on the

Z:/sites/my_site/

files, and my local git seeing that.

I hope its clear what i am asking...

EDIT: The website is PHP based. and i dont WANT to install PHP on my computer, so i can test the code, thats the server's job. i created that server for testing. Ths why i wantto do it this way.

标签: eclipse git egit
3条回答
Ridiculous、
2楼-- · 2019-08-13 19:16

Git is distributed version control system. You can make any number of repositories you want and link them as remotes. Git supports file:// and ssh:// protocols, so you can use it via local network or true-remote servers. I think the best solution is to keep bare repository on your server and clone it anywhere you need.

Also, remember that you can use bitbuket for your projects. It supports unlimited number of private repositories for free for up to five persons.

查看更多
Rolldiameter
3楼-- · 2019-08-13 19:36

Git is a "distributed version control system", where every local repository holds everything (current state and all change history) locally. This way working locally is blazing fast, and you have no dependency on a remote repository like when you work with SVN for example. In light of that, I think what you did is exactly the opposite of what using Git is all about.

To use Git the way it's supposed to be used, you should clone from your central repository, and push updates to that repository. Your local repository can be in C:/git/my_site/.git, and when you're done making changes you push from that repository to the one on Z:.

Take a look at http://git-scm.com/ it has all you need to know to get started with Git "the right way".

查看更多
欢心
4楼-- · 2019-08-13 19:38

Generally the right answer here is to have two git repositories, one on the remote machine and one on your local one, and simply push to the remote machine to deploy the code.

查看更多
登录 后发表回答