今天在GitLab5.2上創建一個項目,然後參考網站的向導在開發機器上創建項目目錄,最後運行
git push -u origin master
結果報錯:
git push -u origin master
fatal: '/home/git/repositories/cloudengine/wtunnel.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.
查了一下,權限沒有問題。最後找到解決方案,原來是GitLab服務器上的/home/git/.ssh/authorized_keys文件的內容和GitLab網站保存的key不一致了。
解決方法是用root身份登錄到gitlab server,進入/home/git/gitlab目錄後,運行命令:
rake gitlab:shell:setup RAILS_ENV=production
它會提示刪除原來的authorized_keys文件內容,然後重新生成。
之後修改一下.ssh的用戶和組的擁有者:
chown -R git /home/git/.ssh
chgrp -R git /home/git/.ssh
然後重新啟動gitlab。 過一會兒再試。
正常工作了。
GitLab 的詳細介紹:請點這裡
GitLab 的下載地址:請點這裡