克隆存储库而不将其作为远程源 [英] Cloning a repository without making it the origin remote

查看:84
本文介绍了克隆存储库而不将其作为远程源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



是否可以克隆存储库而不使原始存储库起源/主?或者我需要克隆它,然后删除远程分支(这是通过 git remote rm origin )完成的?

编辑:存储库只有一个分支,并且没有标签。不需要将原始存储库作为克隆master分支的origin远程存储。



在新计算机上创建一个新存储库:

  git init foo 

然后将旧的存储库拉入新的存储库,而不创建远程:

  cd foo 
git pull< reference旧版本库>

然而,应该注意的是,保存仓库的最简单方法是将zip存储库的目录,并将文件移动到新机器上。这将保留任何和所有的遥控器,标签等。



如下所述,在复制存储库时,从区分大小写的文件系统(例如Linux ,Mac,NTFS)转换为非区分大小写(例如Fat32)。

I'm cloning a git repository from a computer that's going to be wiped.

Is it possible to clone a repository without making the original repository origin/master? Or do I need to clone it, and then delete the remote branch (which is done with git remote rm origin)?

Edit: The repository has only one branch, and no tags.

解决方案

It is not necessary to make the original repository the "origin" remote to clone the master branch.

On the new machine, create a new repository:

git init foo

Then pull the old repository into the new one, without creating a remote:

cd foo
git pull <reference to old repository>

However, it should be noted that the easiest way to save off a repository would be to just zip the repository's directory up and move the files to a new machine. That will preserve any and all remotes, tags, etc.

As noted below, when copying the repository, be careful when going from case-sensitive file systems (eg. Linux, Mac, NTFS) to non-case sensitive (eg. Fat32).

这篇关于克隆存储库而不将其作为远程源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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