Git使用笔记解决[cloned an empty repository,,,][have the correct access rights,,,]

在仓库中,git pull报错,

kex_exchange_identification: Connection closed by remote host
fatal: Could not read from remote repository.

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

Git新建仓库,git clone告警,

warning: You appear to have cloned an empty repository.


  1. 权限
  2. 不是空仓库。


  • 权限



[root@yix]# mkdir yix_project.git
[root@yix repo]# chown yix_git:yix_git yix_project.git
[root@yix repo]# cd yix_project.git/
[root@yix repo]# git init --bare yix_project.git
Initialized empty Git repository in /data/repo/yix_project.git/
[root@yix repo]# chown -R yix_git:yix_git * -R
  • 空仓库

在客户端(以下是小编Windows平台使用 Git Bash的操作日志),

$ touch
$ vim 内容任意,如:I have a dream.

$ git add *
$ git status

On branch master

No commits yet

Changes to be committed:
(use "git rm --cached <file>..." to unstage)

    new file:
$ git commit -m "init"

[master (root-commit) 8178856] init
1 file changed, 1 insertion(+)
create mode 100644

[master (root-commit) 8178856] init
1 file changed, 1 insertion(+)
create mode 100644

$ git push

yix_git@yix's password:
Enumerating objects: 3, done.
Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 206 bytes | 29.00 KiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To yix:/repo/yix_project.git

  • [new branch] master -> master
$ git pull

yix_git@yix's password:
Already up to date.'s password:
Already up to date.