Using git as a centralized version server

亡梦爱人 提交于 2019-12-03 10:50:24

问题


I currently use svn at work.

Our setup is: everyone has a working copy and we commit to a svn server served by apache2.

So I commit changed, the other update, and everyone can work on the copy as they wish.

So it's pretty easy to deploy.

But now, I'd like to do the same thing but with Git. Would it be possible?

I'd like to have a git repo on my main server, develop at home, commit changes to the server, etc.

Thanks for your help


回答1:


Yes it's possible.

On the server where your stuff is located:

  git init
  git add .

On your local computer:

  git clone git://yourserver/repo localfolder

To get changes:

  git pull
  git fetch

To send changes to server:

  git push

Here are links how to setup your server

  • ssh
  • http
  • daemon



回答2:


Git - SVN Crash Course

Especially this is of interest for a starter

git init
git add
git clone git://...
git pull
git fetch
git push

Then check the rest of the documentation on the git site

Git documentation




回答3:


One thing to add to the other answers:

While a centralized workflow (with one "central" Git repository) is off course possible, you need to keep in mind Git organizes its data differently (as a all, looking into the data content to infer various property, like file rename). See this answer for more differences between Svn and Git.

One consequence is that you should not necessarily consider having just one Git central repository, but several, especially if you have many group of files with different and independent history (they evolve each at their own pace).

SVN can store all those different group in one repository and can branch or tag whatever part it wants (it is just a matter of copying what you need in a "directory" representing a branch or a tag). Git branch and tag at the repository level.

If your set of files is quite coherent, you can have one Git central repo, but if you have several components, may be several "central" Git repos are better.




回答4:


Just set up a centralised repo that everyone pushes to and pulls from.

Just because git has no concept of a central or preferred repo, that doesn't mean you can't designate one to be so by convention among your team.




回答5:


Absolutely - you can set up central (bare) GIT repositories that can be used as a central point. Or use something like GitHub.

With GIT it's more a matter of getting your process set up to use it as you wish.



来源:https://stackoverflow.com/questions/1589082/using-git-as-a-centralized-version-server

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