Edit etc/passwd
vi /etc/passwd
- Người dùng có shell:
/sbin/nologinkhông thể đăng nhập qua SSH - Để có thể SSH thay đổi dòng cấu hình user giống với root và admin, thường là
/bin/sh - Example
Edit row
gituser:x:1026:100::/var/services/homes/gituser:/var/packages/Git/target/bin/git-shell
become
gituser:x:1026:100::/var/services/homes/gituser:/bin/sh
- Tạo người dùng
gitusercùng với File Station và WebDAV privilages - Thêm thư mục mới
git(ở/volume1/git) với quyền read/write chogituserandadmin. Đây là thư mục chứa các repos. - Cài đặt gói
Git Server - Mở
Git Servervà cấp quyền chogituser - Mở truy cập SSH (Control Panel > Terminal & SNMP > Enable SSH Service)
- create
~/.sshfolder for gituser on server
ssh [email protected]
mkdir /volume1/homes/gituser/.ssh
- copy public rsa key from local computer to gituser account on server
copy public key from local computer to
/volume1/homes/gituser/.ssh/authorized_keys - change permissions while logged in as root
cd /volume1/homes/gituser/
chown -R gituser:users .ssh
chmod 700 .ssh
chmod 644 .ssh/authorized_keys
- Config for gituser can SSH via rsa key
cd /var/services/homes/
chown gituser
chmod 755 gituser
- create bare repo as root
ssh [email protected]
cd /volume1/git/
git --bare init <repo-name>.git
chown -R gituser:users <repo-name>.git
- Clone repo from NAS
git clone ssh://[email protected]:port/volume1/git/<repo-name>.git
cd /volume1/git
git --bare init <repo-name>.git
git init
git add *
git commit -m "Khoi tao"
git remote add origin ssh://[email protected]:2222/volume1/git/<repo-name>.git
git push origin master
type NUL > .gitignore
echo bower_components > .gitignore
echo node_modules >> .gitignore
echo libs >> .gitignore
Xóa cache của git
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html http://stackoverflow.com/questions/20074692/set-up-git-on-a-nas-with-synologys-official-package http://www.heidilux.com/2014/02/setup-git-server-synology-nas/