Travis错误存储库无法从远程存储库中读取

时间:2018-10-05 12:20:45

标签: git github travis-ci git-submodules

我的文件夹结构如下     rserver-docker包含rserver的gitsubmodule

git子模块(rserver-docker)如下:

[submodule "rserver"]   
path = rserver  
url = git@github.com:VInc/rserver.git

Travis外观如下

before_install:
  - echo $CI_USER_TOKEN
  - echo -e "\n\nmachine github.com\n login $CI_USER_TOKEN\n" >>~/.netrc
  - git submodule update --init --recursive

CI_USER_TOKEN是在Travis设置中更新的个人访问令牌

我遇到如下错误

 $ git clone --depth=50 --branch=dev git@github.com:VInc/rserver-docker.git VInc/rserver-docker
Cloning into 'VInc/rserver-docker'...
Warning: Permanently added the RSA host key for IP address '192.30.253.112' to the list of known hosts.
$ cd VInc/rserver-docker
$ git checkout -qf d445f5afe71a6f3390345842644e600ee4bbb68b
7.47s$ git submodule update --init --recursive
Submodule 'rserver' (git@github.com:VInc/rserver.git) registered for path 'rserver'
Cloning into '/home/travis/build/VInc/rserver-docker/rserver'...
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
fatal: clone of 'git@github.com:VInc/rserver.git' into submodule path '/home/travis/build/VInc/rserver-docker/rserver' failed
Failed to clone 'rserver'. Retry scheduled
Cloning into '/home/travis/build/VInc/rserver-docker/rserver'...
ERROR: Repository not found.

2 个答案:

答案 0 :(得分:1)

有关主题的Travis文档:

  

Git cannot clone my Submodules #

     

如果您的项目使用Git子模块,请确保使用公共Git   网址。例如,在GitHub上,而不是

class Category(models.Model):
    name = models.CharField(max_length=120, verbose_name="name")
    parent = models.ForeignKey('self',blank=True, on_delete = models.CASCADE, null=True ,related_name='children')
    slug = models.SlugField(unique=True, max_length=130)
    def __str__(self):
        return self.name

    def get_article(self):
        return Article.objects.filter(category=self)

class Article(models.Model):
    author = models.ForeignKey("auth.User",on_delete = models.CASCADE, verbose_name="Yazar")
    title = models.CharField(max_length = 120, verbose_name="Başlık")
    category = models.ForeignKey('Category', on_delete=models.CASCADE, null=True, blank=True)
    content = RichTextField(verbose_name="İçerik")
    created_date = models.DateTimeField(auto_now_add=True, verbose_name="Oluşturma Tarihi")
    image = models.ImageField(blank=True, null=True, verbose_name="Foto Ekle (.jpg .png)")
    slug = models.SlugField(unique=True, max_length = 130)
    def __str__(self):
        return self.title

    def get_unique_slug(self):
        slug = slugify(self.title.replace("ı","i"))
        unique_slug = slug
        counter = 1
        while Article.objects.filter(slug=unique_slug).exists():
            unique_slug = '{}-{}'.format(slug, counter)
            counter += 1
        return unique_slug

    def save(self, *args, **kwargs):
        if not self.slug:
            self.slug = self.get_unique_slug()
        return super(Article, self).save(*args, **kwargs)
     

使用

git@github.com:someuser/somelibrary.git

答案 1 :(得分:0)

个人访问令牌存在问题,因为它没有gitclone代码的权限