如何克隆一个git仓库命名空间 [英] How to clone a git repository namespace

查看:564
本文介绍了如何克隆一个git仓库命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

GIT_NAMESPACE = work我想创建一个名称空间并推送到一个裸回购,这里是我所做的,推送作品,克隆,拉没有。



创建了一个空回购和添加来提交



完成git推到裸回购;在裸回购,我确实看到命名空间/工作



现在



如果我克隆它,名称空间不会来。

我有相同的环境变量集。

解决方案

m新的git命名空间,并决定尝试一下。以下脚本是结果。它涉及三个存储库。 样本存储库将推送到 sample-remote 裸仓库的工作名称空间。而且,我将 sample-remote 的工作名称空间克隆到 sample-clone 存储库中。

 #!/ bin / bash 

set -e

cd〜/ Code
git init示例
cd示例
触摸文件
git添加文件
git commit -m第一次提交
git remote add origin〜/ Code / sample- remote.git
git的初始化--bare〜/代码/采样remote.git
GIT_NAMESPACE =工作混帐推主产地
CD ..
混帐克隆转::'混帐--namespace = work%s〜/ Code / sample-remote.git'\
sample-clone -b master
cd sample-clone
touch file2
git add file2
git commit -m第二次提交
git push

如果没有 -b master 参数,我得到以下错误:

  warning:remote HEAD是指不存在的参考,无法结帐。 

,工作目录为空。

I want create a name space and push to a bare repo, here is what I have done, Push works, clone, pull did not.

GIT_NAMESPACE=work

created an empty repo and added come commits

done git push to a bare repo; in bare repo I did see namespace/work

Now

If I clone it, name space did not come.

I have same environment variable set.

解决方案

I'm new to git namespaces and decided to try it out. The following script is the result. It involves three repositories. The sample repository pushes to the work namespace of sample-remote bare repository. And, I'm cloning the work namespace of sample-remote into sample-clone repository.

#!/bin/bash

set -e

cd ~/Code
git init sample
cd sample
touch file
git add file
git commit -m "First commit"
git remote add origin ~/Code/sample-remote.git
git init --bare ~/Code/sample-remote.git
GIT_NAMESPACE=work git push origin master
cd ..
git clone ext::'git --namespace=work %s ~/Code/sample-remote.git' \
    sample-clone -b master
cd sample-clone
touch file2
git add file2
git commit -m "Second commit"
git push

Without the -b master argument, I got the following error:

warning: remote HEAD refers to nonexistent ref, unable to checkout.

and the working directory was empty.

这篇关于如何克隆一个git仓库命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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