1

Linux CentOS サーバーに git ベア リポジトリを作成しました。

/home/git/niels.git.

ユーザー git と niels はグループ git に属しています。

niels のホームディレクトリが git になるように /etc/passwd を変更しました。

niels.git への git としての ssh : プッシュとプルはうまくいきます。

同じ方法で niels として ssh を実行すると、次のようになります。

fatal: '~/niels.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.

git としてアクセスできるので、明らかにリポジトリが存在します。ここにいくつかの権利とグループ情報があります:

# ls -al /home/git

total 32
drwxrwx--- 4 git  git   4096 Sep 20 22:11 .
drwxr-xr-x 5 root root  4096 Sep 17 14:39 ..
-rwxr----- 1 git  10009  953 Sep 17 14:19 .bash_history
-rwxr----- 1 git  10009   33 Sep 12 22:46 .bash_logout
-rwxr----- 1 git  10009  176 Sep 12 22:46 .bash_profile
-rwxr----- 1 git  git    124 Sep 12 22:46 .bashrc
drwxrw---- 7 git  git   4096 Sep 17 17:19 niels.git
drwxr----- 2 root 10009 4096 Sep 15 22:40 .ssh

# groups niels

niels : niels git 

私は何を間違っていますか?

ところで、私はあらゆる種類の許可を試しました

chmod -R 740 /home/git

そして766 666ですが、777でのみ解放されます:

Already up-to-date.

でもそんなわけないでしょ…

4

1 に答える 1

0

でもそんなわけないでしょ…

/home/git/しかし、それは方法です。「git」以外のユーザーとしてリポジトリにアクセスすることは想定されていません。

ssh はリモート サーバー (アップストリーム repoを持つサーバー) でセキュア シェルを開き、そのシェルは ssh url: で言及したユーザーで使用されますgit。これは、にアクセスするために機能し/home/gitます。

を変更するだけでは、そのホーム ディレクトリの所有権/etc/passwordを変更するのに十分ではありません。

あなたは試すことができます:

sudo chmod 744 -R egit /home/git

(ただし、アカウントgitは同じリポジトリへのアクセスに問題があります)

于 2013-09-21T00:35:14.570 に答える