简体   繁体   中英

Git remote does not appear to be a git repository

I'm working on a craft cms application. The repo has 3 remotes:

  • origin (bitbucket)
  • staging (testing site)
  • production (live site)

All of the remotes used to work, but then the production broke for no reason.

Here's how the error looks:

fatal: '/srv/users/******/apps/****/repo' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

here's how config file looks on the server

[core]
    repositoryformatversion = 0
    filemode = true
    bare = true
[remote "origin"]
    url = git@bitbucket.org:****/****.git
    fetch = +refs/*:refs/*
    mirror = true

don't know what else to check considering that it used to work :-(

upd.

turns out the object folder slipped into another folder(thanks to my boss) and just moving it back solved the problem!

It depends on the commands which produced the error.

git ls-remote production should work.
But your current local configuration does not show any remote " production " origin, so you might need to add it back.

I asked the OP Mikhai Cheburakhtin if, in an interactive remote shell session, he can access /srv/users/serverpilot/apps/****/repo , and do a git log in it:

Yes I can, but it throws an error: fatal: Not a git repository (or any of the parent directories): .git

That would explain the error message.

The OP adds:

I started comparing repo folders and there is objects folder that was missing and I find it inside another folder: so just moving this folder back to it's place solved the problem!

here's how my local config file looks:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    ignorecase = true
    precomposeunicode = true
[remote "staging"]
    url = ssh://serverpilot@********.com/~/apps/****-staging/repo
    fetch = +refs/heads/*:refs/remotes/staging/*
[remote "origin"]
    url = https://********@bitbucket.org/******/****.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[remote "production"]
    url = serverpilot@****.com:/srv/users/serverpilot/apps/****/repo
    fetch = +refs/heads/*:refs/remotes/production/*

Another question is should the config file on the server have any remotes beside origin?

also, both production and staging folders on the server have repo folder and the config file in the staging folder doesn't have any remotes and works:

[core]
    repositoryformatversion = 0
    filemode = true
    bare = true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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