新起一個項目,要從服務端做起。我是用docker搭建的hg server,我的repos目錄在~/hg-repos/repos下,那么我可以去此目錄init一個項目,然后其他端就可以clone下來。問題是我在此目錄做 hg init 操作需要root權限,如下:
~~~
$ sudo hg init linctest
$ ll
drwxr-xr-x 3 root root 4096 3月 26 17:59 linctest/
~~~
那么在push代碼時就會發生如下錯誤:
~~~
$ hg push
pushing to http://linc-ubuntu/linctest
searching for changes
http authorization required for http://linc-ubuntu/linctest
realm: Repositories
user: linc
password:
abort: HTTP Error 500: Permission denied
~~~
原來阿,還是目錄權限的問題,或者說是目錄的所有者問題。?
看看其他項目就知道了。
~~~
$ ll
drwxrwxr-x 3 www-data www-data 4096 1月 30 14:18 xxxxx
~~~
此時,只需做一下改變就可以了。
~~~
$ sudo chown www-data:www-data -R linctest
~~~