git GitLab:无法从远程存储库读取

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18547063/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:59:32  来源:igfitidea点击:

GitLab: Could not read from remote repository

linuxgitubunturepositorygitlab

提问by Christian Hammer

I created my project and added my ssh-key (both over webinterface), but when I try to push something to the repo, I get this error: "Could not read from the repository". This might be due to the fact, that the .git-project-file does not exist in the /home/git/repositories/[group]/ folder.

我创建了我的项目并添加了我的 ssh 密钥(都通过网络界面),但是当我尝试将某些内容推送到存储库时,出现此错误:“无法从存储库中读取”。这可能是因为 /home/git/repositories/[group]/ 文件夹中不存在 .git-project-file。

The gitlab-check returns:

gitlab-check 返回:

[Group] / [Project] ... can't create, repository is empty

Error when pushing to repository

推送到存储库时出错

git remote add origin [email protected]:[group]/[project].git

git remote add origin [email protected]:[group]/[project].git

git push -u origin master

git push -u 原点大师

fatal: '/home/git/repositories/[group]/[project].git' 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.

What might have caused the error

什么可能导致错误

ls -ld /home/git/repositories/[group]/[project].git

ls -ld /home/git/repositories/[group]/[project].git

File not found.

Why was the file not created?

为什么没有创建文件?

Infos about my setup

关于我的设置的信息

ls -ld /home/ /home/git/

ls -ld /home/ /home/git/

drwxr-xr-x 3 root root 4096 Aug 28 15:04 /home/
drwxr-xr-x 8 git  git  4096 Aug 31 11:33 /home/git/

ll /home/git

我 / 家 / git

drwxr-xr-x  8 git  git  4096 Aug 31 11:33 ./
drwxr-xr-x  3 root root 4096 Aug 28 15:04 ../
-rw-r--r--  1 git  git   220 Aug 28 15:04 .bash_logout
-rw-r--r--  1 git  git  3637 Aug 28 15:04 .bashrc
drwx------  2 git  git  4096 Aug 29 19:52 .cache/
-rw-r--r--  1 git  git    88 Aug 31 11:33 .gitconfig
drwxr-xr-x 16 git  git  4096 Aug 29 15:32 gitlab/
drwxr-xr-x  2 git  git  4096 Aug 28 15:09 gitlab-satellites/
drwxr-xr-x  8 git  git  4096 Aug 29 19:51 gitlab-shell/
-rw-------  1 git  git    13 Aug 29 15:36 .mysql_history
-rw-r--r--  1 git  git   675 Aug 28 15:04 .profile
drwxrws---  5 git  git  4096 Aug 29 16:15 repositories/
drwx------  2 git  git  4096 Aug 31 11:47 .ssh/
-rw-------  1 git  git  3453 Aug 29 16:03 .viminfo

sudo -u git -H bundle exec rake gitlab:env:info

sudo -u git -H bundle exec rake gitlab:env:info

RAILS_ENV=production

System information
System:     Ubuntu 13.04
Current User:   git
Using RVM:  no
Ruby Version:   2.0.0p247
Gem Version:    2.0.3
Bundler Version:1.3.5
Rake Version:   10.1.0

GitLab information
Version:    6.0.0
Revision:   6c1c284
Directory:  /home/git/gitlab
DB Adapter: mysql2
URL:        http://myserver.com
HTTP Clone URL: http://myserver.com/some-project.git
SSH Clone URL:  [email protected]:some-project.git
Using LDAP: no
Using Omniauth: no

GitLab Shell
Version:    1.7.0
Repositories:   /home/git/repositories/
Hooks:      /home/git/gitlab-shell/hooks/
Git:        /usr/bin/git

sudo -u git -H bundle exec rake gitlab:check

sudo -u git -H bundle exec rake gitlab:check

RAILS_ENV=production
Checking Environment ...

Git configured for git user? ... yes
Has python2? ... yes
python2 is supported version? ... yes

Checking Environment ... Finished

Checking GitLab Shell ...

GitLab Shell version >= 1.7.0 ? ... OK (1.7.0)
Repo base directory exists? ... yes
Repo base directory is a symlink? ... no
Repo base owned by git:git? ... yes
Repo base access is drwxrws---? ... yes
post-receive hook up-to-date? ... yes
post-receive hooks in repos are links: ... 
[Group] / [Project] ... repository is empty

Checking GitLab Shell ... Finished

Checking Sidekiq ...

Running? ... yes

Checking Sidekiq ... Finished

Checking GitLab ...

Database config exists? ... yes
Database is SQLite ... no
All migrations up? ... yes
GitLab config exists? ... yes
GitLab config outdated? ... no
Log directory writable? ... yes
Tmp directory writable? ... yes
Init script exists? ... yes
Init script up-to-date? ... yes
Projects have satellites? ... 
[Group] / [Project] ... can't create, repository is empty
Redis version >= 2.0.0? ... yes
Your git bin path is "/usr/bin/git"
Git version >= 1.7.10 ? ... yes (1.8.1)

Checking GitLab ... Finished

ssh -T [email protected]

ssh -T [email protected]

Welcome to GitLab, Christian Hammer!

cat /home/git/.ssh/authorized_keys

猫 /home/git/.ssh/authorized_keys

command="/home/git/gitlab-shell/bin/gitlab-shell key-2",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa [key] [email]

采纳答案by Christian Hammer

(Re)starting sidekiqsolved the problem:

(重新)启动sidekiq解决了问题:

sudo -Hu git RAILS_ENV=production bundle exec rake sidekiq:start

回答by theDrifter

I had the same problem. But for me restarting sidekiq did not solve it. So i leave a small solution for the same error message. I manage the server gitlab is running on, so i created one key for remote ssh access (gitlab-server.pub) and another one (gitlab-repo.pub) for the repository. In the gitlab interface i uploaded gitlab-repo.pubbut i forgot git to tell which one to use so after updating ~/.ssh/configlike thiseverything works

我有同样的问题。但是对我来说重新启动 sidekiq 并没有解决它。所以我为相同的错误消息留下了一个小解决方案。我管理运行 gitlab 的服务器,因此我创建了一个用于远程 ssh 访问的密钥 ( gitlab-server.pub) 和另一个gitlab-repo.pub用于存储库的密钥( )。在gitlab界面我上载 gitlab-repo.pub,但我忘了的Git告诉更新后使用哪一个这么~/.ssh/config喜欢这个一切正常

回答by Shunya

From the information you have given, it is not able to create. Please check what exists inside of repositories/[group] directory.
If your repository is a bare repository (one which does not have working directory), then it is a convention to use a name like [project.git].

根据您提供的信息,它无法创建。请检查 repositories/[group] 目录中存在的内容。
如果你的仓库是一个裸仓库(一个没有工作目录的仓库),那么使用像 [project.git] 这样的名字是一种约定。