将 git 更改推送到共享网络驱动器 [英] Push git changes to a shared network drive

查看:21
本文介绍了将 git 更改推送到共享网络驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

四人团队如何使用 Git(特别是 Github for Windows)将本地更改推送到共享网络驱动器?

现在(没有 Git)我们必须将文件从网络驱动器复制到我们的本地机器,编辑文件,然后将它们重新上传到共享网络驱动器.这是一个艰苦的过程,可能会导致很多错误,但 Git 似乎可以帮助我们.

我们可以简单地在共享驱动器上安装 Git 并从那里开始吗?

解决方案

不确定你是否找到了适合你的东西,但我有一篇关于如何在 Windows 网络驱动器上做这件事的文章:

http://tony.halcyonlane.com/blog/2011/09/22/Using-git-at-work-on-a-Windows-network-drive/

从 cmd 提示更改到您的映射驱动器.

<块引用>

$ cd g:

然后 cd 到您即将成为 git 存储库中.

<块引用>

$ cd 脚本

然后创建一个空的git仓库.如果您不使用 --bare 选项,则会出现问题,因此请不要忽略这一点.

<块引用>

$ git init --bare

现在,如果您还没有本地 git 存储库,那么您可以导航回本地驱动器,随时随地克隆您的新存储库.

<块引用>

$ c:

$ cd 工作/脚本

$ git clone file://g:scripts

当您克隆时,您会自动获得一个名为origin"的遥控器.并且您可以在本地进行任何更改时推送到服务器以安全保存.

<块引用>

$ git push origin master

如果您已经有一个 git 存储库并且只想推送到共享驱动器,那么您可以从本地 git 目录中执行此操作.

<块引用>

$ git remote add origin file://g:scripts

$ git push origin master

How can a team of four people use Git (specifically Github for Windows) to push local changes to a shared network drive?

Right now (without Git) we have to copy the files from the network drive to our local machine, edit the files, and then re-upload them to the shared network drive. This is a painstaking process that can lead to lots of errors, but it seems like something Git could help us with.

Can we simply install Git on the shared drive and go from there?

解决方案

Not sure if you found something that works for you or not, but I have a writeup on how to do that very thing on a windows network drive:

http://tony.halcyonlane.com/blog/2011/09/22/Using-git-at-work-on-a-Windows-network-drive/

From a cmd prompt change to your mapped drive.

$ cd g:

Then cd into your soon to be git repository.

$ cd scripts

Then create an empty git repository. If you do not use the --bare option, you will have issues so don't leave that out.

$ git init --bare

Now if you don't have a local git repository yet, then you can clone your new repository wherever you like by navigating back to your local drive.

$ c:

$ cd work/scripts

$ git clone file://g:scripts

When you clone, you automatically get a remote called "origin" and you can push to the server for safe keeping any time you make changes locally.

$ git push origin master

If you already have a git repository and you just want to push out to the shared drive then you can do this from within your local git dir.

$ git remote add origin file://g:scripts

$ git push origin master

这篇关于将 git 更改推送到共享网络驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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