简体   繁体   English

如何使用git设置PC和Mac

[英]How to setup PC and Mac for using git

I use git both for Mac and PC. 我在Mac和PC上都使用git。

When pulling Mac's git from PC, it's easy as I can use ssh. 从PC提取Mac的git时,很容易,因为我可以使用ssh。

git clone smcho@prosseek:~/smcho/setup

The problem happens the other way round : to pull from Mac. 问题反过来又发生了:从Mac中拉出。 I guess there are two ways to go. 我猜有两种方法。

Method 1 : Connect to server 方法1:连接到服务器

By using 'connect to server' in Mac, I can make PC's directory like that of Mac. 通过在Mac中使用“连接到服务器”,我可以使PC的目录类似于Mac。 Even though, the file permission issue, it works pretty well. 即使出现文件权限问题,它也能很好地工作。

Method 2 : ssh 方法2:ssh

I could run cygwin ssh server (cygrunsrv -S sshd) to be accessed from other computers, but for me, I have to wait quite a while to get connection as I explained here . 我可以运行cygwin ssh服务器(cygrunsrv -S sshd)以从其他计算机进行访问,但是对我来说,我必须等待相当长的一段时间才能获得连接,如我在此处说明的。 It's almost impossible for to use it with git, as I don't want to wait for minutes to get clone. 与git一起使用几乎是不可能的,因为我不想等待几分钟来获取克隆。

Here comes my question. 我的问题来了。

  • Is there any better way other than the previous two methods? 除了前两种方法之外,还有其他更好的方法吗?
  • Is there a (natural) way to support ssh server from Windows (windows 7 precisely) not using cygwin? 是否有不使用cygwin的(自然)方式从Windows(确切地说是Windows 7)支持ssh服务器?

I've started using the philosophy of trying to stick in the native environment that something is designed for. 我已经开始尝试尝试坚持设计特定环境的本机环境。

With that in mind, my windows box has an ubuntu server virtual machine that hosts my git repositories. 考虑到这一点,我的Windows框具有一个托管我的git存储库的ubuntu服务器虚拟机 The nice thing is the linux + virtual box + git is an awesome source repository that is completely free. 不错的是linux + virtual box + git是一个很棒的源代码仓库,它是完全免费的。 No extra machine and you can give it very little memory so it isn't a resource hog. 没有多余的机器,您可以给它很少的内存,因此它不是资源浪费。

I see two other solutions : 我看到另外两个解决方案:

  • using a third synchronisation server: GitHub , the most famous (if your program is OpenSource), but you can also find free online private Git repositories 使用第三个同步服务器:最著名的GitHub (如果您的程序是OpenSource),但是您也可以找到免费的在线私人Git存储库
  • on Windows, you can set up the Git server ('git daemon' command). 在Windows上,您可以设置Git服务器(“ git daemon”命令)。 On MAC, you'll access to the Windows repository using the URL git://ip_of_windows_machine/repository/ 在MAC上,您将使用URL git:// ip_of_windows_machine / repository /访问Windows存储库

There is even another option: 甚至还有另一个选择:

If you use both computers for developing and just want to keep the repositories in sync, you could create a bare repository and use something like Dropbox to synchronize it. 如果您同时使用两台计算机进行开发,并且只想使存储库保持同步,则可以创建一个裸存储库,并使用Dropbox之类的工具对其进行同步。

You might consider another approach entirely. 您可能会完全考虑另一种方法。 If you're using git as a revision control system that you might consider a hosted account for mastering your repository, maintaining backups, etc. http://github.com/ is the leader in the space for git. 如果您将git用作版本控制系统,则可以考虑使用托管帐户来控制存储库,维护备份等。http://github.com/是git领域的领导者。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM