
私はルート経由で VPS 上に git リポジトリを作成し、それを共有して、グループの人々がアクセスできるようにしました。
# mkdir example.git
# cd example.git
# git init --bare --shared=group
Initialized empty shared Git repository in /root/example.git/
# ls
branches config description HEAD hooks info objects refs
# chgrp -R devs .
次に、ローカル PC のユーザーとしてディレクトリを作成し、この git リポジトリの新しい origin として example.git を追加しました。最後に origin にプッシュしようとしました。
mkdir bubbles && cd bubbles
bubbles ranuka$ git init
Initialized empty Git repository in /Users/ranuka/Desktop/bubbles/.git/
bubbles ranuka$ ls
bubbles ranuka$ git remote add origin [email protected]:example.git
bubbles ranuka$ echo "Hello" > readme.txt
bubbles ranuka$ git add readme.txt
bubbles ranuka$ git commit -m "Adding a readme file"
[master (root-commit) 2c89e43] Adding a readme file
1 file changed, 1 insertion(+)
create mode 100644 readme.txt
bubbles ranuka$ git push origin master
[email protected]'s password:
fatal: 'example.git' does not appear to be a git repository
example.git は明らかに私の VPS 上のリポジトリであることはわかっているので、このエラーに困惑しています。私は「ranuka」として VPS にログインし、example.git に cd しようとしましたができませんでしたが、何らかの理由で root としてできました。何が起こっているのでしょうか?
私の目標は、特定のグループの多数のユーザーがアクセスしてプッシュ/プルできる Git リポジトリを VPS 上に作成することでした。
編集: ls -aを実行した後[メールアドレス]そして[メールアドレス] 結果は次のとおりです。
. example.git
.. gitosis
ajenti-repo-1.0-1.noarch.rpm install.log
anaconda-ks.cfg install.log.syslog
.bash_history pgdg-centos93-9.3-1.noarch.rpm
.bash_logout .pki
.bash_profile repo.git
.bashrc .rnd
.cshrc .ssh
epel-release-6-8.noarch.rpm .tcshrc
そして
. .. .bash_logout .bash_profile .bashrc
つまり、root と ranuka はまったく関係のない異なるディレクトリに配置されているように見えます。
答え1
ユーザーごとにホーム フォルダが異なります。root
としてログインすると、ホームは になります/root
。
他のユーザーはアクセスできません。
ranuka としてログインした場合、ホームは (おそらく) です/home/ranuka
。
もちろん、 にあるため、フォルダは含まれません/root
。