Git 软件(例如 Gitbox、Github、SourceTree)可以使用远程仓库而不是本地仓库吗? [英] Can Git software (e.g. Gitbox, Github, SourceTree) use a remote repo instead of local?

查看:31
本文介绍了Git 软件(例如 Gitbox、Github、SourceTree)可以使用远程仓库而不是本地仓库吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我喜欢使用 Git 软件来推送提交,但是我使用的那些(Gitbox、Github、SourceTree)在向它们添加新存储库时都要求本地存储库.

I like using Git software to push commits, but the ones I use (Gitbox, Github, SourceTree) all ask for a local repo when adding a new repo to them.

事实是,我的存储库在我的开发服务器上,而不是我的本地机器上.

Thing is, my repo is on my development server not my local machine.

那么 Git 软件可以使用远程 Git 存储库作为开发存储库,然后将其推送到您的主存储库(例如 Github 或 Bitbucket)吗?

So can Git software use a remote Git repo as a development repo, then push that to your main repo (e.g. Github or Bitbucket)?

否则,您似乎无法使用该软件,而必须通过 SSH 使用命令行.

Otherwise it seems you cannot use the software and have to resort to command line over SSH.

谢谢

推荐答案

一种不依赖前端来支持直接操作远程仓库的解决方案是将远程安装为网络文件系统.如果您只能通过 SSH 访问远程机器,您可以尝试通过 SSHFSfuse.sourceforge.net/">FUSE(在 Linux 上)或 OSXFUSE 在 Mac OS X 上.或者根据您的喜好和设置,您可以使用 SMB、NFS、DAV 或其他网络文件系统.

One solution, which doesn't rely on the front-end to support manipulating a remote repo directly, would be to mount the remote as a networked filesystem. If you only have SSH access to the remote machine, you could try using SSHFS via FUSE (on Linux) or OSXFUSE on Mac OS X. Or depending on your preferences and setup, you could use SMB, NFS, DAV, or another network filesystem.

我在评论中提出的另一种方法是将网络文件系统从您的开发机器导出到您的服务器.我这样做是为了我可以一次在多台机器上安装我当前的工作副本,而且即使我没有连接到服务器,我仍然拥有我的本地工作副本.

Another way to do it, that I bring up in the comments, is to export the network filesystem from your development machine to your server. I do this so that I can mount my current working copy on multiple machines at once, and also so that I still have my local working copy even when I'm not connected to the server.

你写道:

我很惊讶 git 软件无法将远程存储库作为工作版本处理.

I am surprised git software can't deal with remote repos as the working version.

大多数 Git GUI 通过调用 git 命令来完成一些工作.为了让它们支持远程操作,核心 Git 也必须支持.它是用 C 和 shell 脚本混合编写的;所有这些都必须重写才能处理远程文件.

Most Git GUIs do some of their work by calling out to the git command. In order for them to support remote operation, core Git would have to as well. It is written in a mix of C and shell script; all of that would have to be rewritten to cope with remote files.

文本编辑器的工作要容易得多;它在打开时读取一个文件,在保存时写入,而 Git 在一个操作过程中读取和写入多个文件,例如 commit.

A text editor has a much easier job; it reads one file when you open it, and writes when you save, while Git reads and writes many files in the course of a single operation like commit.

网络文件系统意味着所有工具(Git 和其他工具)都可以处理您的远程文件.不是在每个应用程序中构建一个层来支持网络文件访问,而是在内核中(或通过 FUSE)完成,然后将其视为本地文件系统,在每个应用程序中免费为您提供支持.

A networked filesystem would mean that all tools (Git and otherwise) will work on your remote files. Instead of building a layer into each and every application to support networked file access, doing it in the kernel (or via FUSE) and then just treating it like a local filesystem gives you that support in every application for free.

这篇关于Git 软件(例如 Gitbox、Github、SourceTree)可以使用远程仓库而不是本地仓库吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆