我在使用 Git 时遇到问题。请记住,我对 Git 还很陌生。
问题:我需要将我的工作同步到我的家庭/手机。我的工作场所使用SVN,无法从外部访问(我无法更改这一点)。我也被阻止从 ssh 到外部(我也无法更改这一点)。回到我家,我需要提交更改。
建议的解决方案:
SVN Server -> Git (in my Office PC) -> Github -> Git (in my House PC)
SVN Server <- Git (in my Office PC) <- Github <- Git (in my House PC)
我选择 Github 的原因是因为它支持 HTTPS,这将解决我通过 ssh 到办公室外部的问题。
所以,我的问题是:
- 这是正确的方法吗?
- 如果它足够好,任何人都可以给我一个粗略的例子来说明我该如何做到这一点?
我知道第二个问题是个大问题,但我在将我的更改从我的房子合并回 SVN 服务器时遇到了麻烦。提前致谢。
更新:
我实际上已经考虑使用 USB 驱动器作为传输我的 Git 存储库的介质。然而,我希望有一种方法,让我根本不必使用 USB 驱动器(所有这些都在互联网上自动排序,担心我会把 USB 掉在某个地方)。我什至使用过 Dropbox 一段时间,但后来,存储库开始变得太大,Dropbox 无法很好地处理大量小文件(超过 20,000 个)。
经过一番考虑(过程的复杂性、数据的敏感性),我想我只会使用 USB 驱动器来传输我的 Git 存储库。不过,我会保留这个问题,以便我可以从这个问题中学习一些 Git 命令。
顺便说一下,这是我当前的工作流程:
-
SVN Server -> Git(办公电脑)-> Github-> Git(家用电脑)
没问题
- 在我家:创建了一个登录分支并将其推送回 Github。
- 在办公室:我第一次从 Github 存储库克隆回来并合并登录分支。
- 然后, git svn init svn://url -s
- ???
我尝试了一些命令,但我认为它不起作用,希望有人可以帮助从第 5 步开始。
I'm having a problem using Git. Bear in mind I'm very new to Git.
The problem: I need to sync my work to my home/mobile. My workplace uses SVN and it cannot be accessed from outside (I can't change this). I'm also blocked from sshing to outside (I can't change this too). Back at my house, I need to commit my changes.
Proposed solution:
SVN Server -> Git (in my Office PC) -> Github -> Git (in my House PC)
SVN Server <- Git (in my Office PC) <- Github <- Git (in my House PC)
The reason I'm choosing Github is because of its HTTPS support, this will solve my problem in sshing to outside of my office.
So, my question is:
- Is this the correct way to do it?
- If it is good enough, can anyone give me a rough example on how can I do this?
I know 2nd question is a big one, but I'm having trouble merging my changes from my house back to the SVN server. Thanks in advance.
Update:
I've actually cosider using a USB drive as the medium to transfer my Git repository. However, I was hoping for a way so that I don't have to use USB drive at all (all automatically sorted in the Internet and was afraid I'll drop my USB somewhere). I even used Dropbox for a while, but then, the repository started to get too big and Dropbox doesn't play well with a lot of small files (more than 20,000).
After some consideration (the complexity of the process, the sensitivity of the data), I think I'll just USB drive to transfer my Git repository. However, I'll keep the question open so that I can learn some Git commands from this problem.
By the way, this is my current workflow in general:
SVN Server -> Git (Office PC) -> Github -> Git (House PC)
No Problem
- At my house: Created a login branch and pushed it back to Github.
- At the office: For the first time, I cloned back from my Github repository and merge the login branch.
- Then,
git svn init svn://url -s
- ???
I've tried a few commands, but I don't think it's working, was hoping someone could help starting with step 5.
发布评论
评论(2)
假设工作不希望您将代码库推送到 GitHub,即使在私人存储库中,您也可以将远程存储库添加到已安装的 USB 驱动器中,并来回携带它。
Assuming that work wouldn't want you pushing the code base to GitHub, even in a private repo, you could add a remote repo to a mounted USB drive, and carry it back and forth.
我想到了一些事情:
也许一个不错的选择是将
git svn clone
存储库到闪存驱动器上。然后把它带回家,研究它,并建立承诺。然后你可以 git svn rebase &&当你开始工作时,按照正常的 git-svn 工作流程,从存储库中执行 git svn dcommit 。编辑:您是否考虑过在备用端口上运行 sshd 或通过 HTTP(S) 代理 SSH?过去,我在使用一种或另一种技术时运气很好,具体取决于有效的限制。它可能不合规矩,但我确信这比将公司的源代码存储在 Github 上要好得多。
A few things come to mind:
Perhaps a good option would be to
git svn clone
the repository onto a flash drive. Then take that home, work on it, and build up commits. Then you cangit svn rebase && git svn dcommit
from the repository when you get to work, as per the normal git-svn workflow.EDIT: Have you considered running sshd on an alternate port or proxying SSH over HTTP(S)? I've had good luck in the past with one technique or the other, depending on the restrictions in effect. It may not be kosher, but I'm sure it's a hell of a lot better than storing your company's source code on Github.