简体   繁体   English

没有git-clone,如何获得git项目?

[英]How do you get a git project without git-clone?

I'm trying to get started using git. 我正在尝试开始使用git。 Our project is in a directory with a base development system. 我们的项目位于具有基本开发系统的目录中。 I've got it set up great for myself, but I can't get the files over to my collaborators. 我已经对自己进行了很好的设置,但是我无法将文件移交给我的合作者。

We can't do a git clone since it has to clone to an empty directory. 我们无法执行git clone,因为它必须克隆到一个空目录。

I tried initializing a repository in the dev directory on one of the systems, adding a remote to my repo, then running git-fetch. 我尝试在其中一个系统的dev目录中初始化存储库,将远程存储添加到我的仓库中,然后运行git-fetch。 It did a lot of computing and downloading, but in the end, .git/ ended up with lots of stuff, but the files in the dev directory remain untouched. 它进行了大量的计算和下载,但最终,.git /包含了很多内容,但dev目录中的文件保持不变。 ls-files shows nothing. ls文件什么也不显示。

I expected the fetch to pull down all the files. 我希望提取会拉下所有文件。 What am I misunderstanding here? 我在这里误会什么?

git fetch will only update the remote namespace of your dev repo. git fetch仅会更新您的开发仓库的远程名称空间。
Its working tree will remain untouched (that is "empty", except for all the legacy and private files already there) 其工作树将保持不变(“空”,除了已存在的所有旧文件和私有文件之外)

Did you try git pull ? 您尝试过git pull吗?
It would git fetch and git merge the remote content into your master branch, filling your working tree in the same time. 它将git fetch git merge远程内容git merge到您的master分支中,同时填充您的工作树。

It's really unclear what you're describing in this question. 目前还不清楚您在此问题中所描述的内容。 Do you already have git repository setup? 您已经有git仓库设置了吗? If 'yes', then what is the exact reason you can not clone from it? 如果为“是”,那么您不能从中克隆的确切原因是什么? If 'no', then the first think you need to do is: 如果为“否”,那么您首先需要做的是:

cd project/
git init
git add --all
git commit -m "Initial commit"

Use git-bundle that can transfer the whole repo contents in a archive. 使用git-bundle可以传输整个repo内容到一个归档文件中。

For the docs 对于文档

Some workflows require that one or more branches of development on one machine be replicated on another machine, but the two machines cannot be directly connected, and therefore the interactive git protocols (git, ssh, rsync, http) cannot be used. 一些工作流程要求在一台机器上的一个或多个开发分支在另一台机器上复制,但是两台机器不能直接连接,因此不能使用交互式git协议(git,ssh,rsync,http)。 This command provides support for git fetch and git pull to operate by packaging objects and references in an archive at the originating machine, then importing those into another repository using git fetch and git pull after moving the archive by some means (eg, by sneakernet). 该命令支持git fetch和git pull的操作,方法是将对象和引用打包在原始计算机上的归档文件中,然后在通过某种方式(例如,通过sneakernet)移动归档文件后,使用git fetch和git pull将它们导入另一个存储库中。 As no direct connection between the repositories exists, the user must specify a basis for the bundle that is held by the destination repository: the bundle assumes that all objects in the basis are already in the destination repository. 由于存储库之间不存在直接连接,因此用户必须为目标存储库所拥有的捆绑软件指定基础:捆绑软件假定该基础中的所有对象都已在目标存储库中。

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

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