Skip to content

Instantly share code, notes, and snippets.

@ngoviet
Forked from walkerjeffd/Synology-Diskstation-Git.md
Last active August 16, 2021 14:00
Show Gist options
  • Save ngoviet/ff08a7eb9f9da510564d to your computer and use it in GitHub Desktop.
Save ngoviet/ff08a7eb9f9da510564d to your computer and use it in GitHub Desktop.

Revisions

  1. ngoviet revised this gist Oct 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -60,7 +60,7 @@ git clone ssh://[email protected]:port/volume1/git/<repo-name>.git
    ```
    ## Khởi tạo git trên server
    ```
    cd volume1/git
    cd /volume1/git
    git --bare init <repo-name>.git
    ```
    ## Đẩy project có sẵn lên git
  2. ngoviet revised this gist Oct 23, 2015. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -10,6 +10,7 @@ vi /etc/passwd
    - Example

    Edit row

    `gituser:x:1026:100::/var/services/homes/gituser:/var/packages/Git/target/bin/git-shell`

    become
  3. ngoviet revised this gist Oct 23, 2015. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,12 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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

    Edit row
    `gituser:x:1026:100::/var/services/homes/gituser:/var/packages/Git/target/bin/git-shell`
    * become

    become

    `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

  4. ngoviet revised this gist Oct 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,9 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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
    * Edit row
    `gituser:x:1026:100::/var/services/homes/gituser:/var/packages/Git/target/bin/git-shell`
    become
    * become
    `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

  5. ngoviet revised this gist Oct 23, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -8,10 +8,10 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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.
    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`
    become
    `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

    - Tạo người dùng `gituser` cùng với File Station và WebDAV privilages
  6. ngoviet revised this gist Oct 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,9 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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
    Edit row.
    `gituser:x:1026:100::/var/services/homes/gituser:/var/packages/Git/target/bin/git-shell`
    #become
    become.
    --* `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

  7. ngoviet revised this gist Oct 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,9 @@ vi /etc/passwd
    - Để 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`
    `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`
    --* `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

    - Tạo người dùng `gituser` cùng với File Station và WebDAV privilages
  8. ngoviet revised this gist Oct 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -8,9 +8,9 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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
    #Edit row
    > `gituser:x:1026:100::/var/services/homes/gituser:/var/packages/Git/target/bin/git-shell`
    become
    #become
    > `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

  9. ngoviet revised this gist Oct 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -9,9 +9,9 @@ vi /etc/passwd
    - Để 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`
    > `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`
    > `gituser:x:1026:100::/var/services/homes/gituser:/bin/sh`
    ### Cấu hình người dùng và thư mục git

    - Tạo người dùng `gituser` cùng với File Station và WebDAV privilages
  10. ngoviet revised this gist Oct 23, 2015. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -7,9 +7,11 @@ vi /etc/passwd
    ```
    - Người dùng có shell: `/sbin/nologin` khô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`
    `vara:x:1026:100::/var/services/homes/vara:/var/packages/Git/target/bin/git-shell`
    ###-------------->
    `vara:x:1026:100::/var/services/homes/vara:/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`
    ### Cấu hình người dùng và thư mục git

    - Tạo người dùng `gituser` cùng với File Station và WebDAV privilages
  11. ngoviet revised this gist Oct 23, 2015. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    Cấu hình NAS Synology thành Git Server
    ------------------------------------

    ### Cho phép SSH
    sửa
    Edit `etc/passwd`
    ```
    vi /etc/passwd
    ```
  12. ngoviet revised this gist Oct 23, 2015. 1 changed file with 10 additions and 33 deletions.
    43 changes: 10 additions & 33 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    Configure Synology NAS as Git Server
    Cấu hình NAS Synology thành Git Server
    ------------------------------------

    ### Cho phép SSH
    @@ -20,61 +20,38 @@ vi /etc/passwd
    - Mở truy cập SSH (Control Panel > Terminal & SNMP > Enable SSH Service)

    ### Configure SSH Access

    - create `~/.ssh` folder for gituser on server

    ```
    ssh [email protected]
    mkdir /volume1/homes/gituser/.ssh
    ```

    - copy public rsa key from local computer to gituser account on server

    ```
    scp ~/.ssh/id_rsa.pub [email protected]:/volume1/homes/gituser/.ssh
    ```

    - connect via SSH as `root` and rename `id_rsa.pub` to `authorized_keys` on NAS (or append if already exists, `cat id_rsa.pub >> authorized_keys`)

    ```
    ssh [email protected]
    mv /volume1/homes/gituser/.ssh/id_rsa.pub /volume1/homes/gituser/.ssh/authorized_keys
    ```

    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
    ```
    ### Set Up New Repo on NAS

    - create bare repo as root

    ```
    ```
    ssh [email protected]
    cd /volume1/git/
    git --bare init <repo-name>.git
    chown -R gituser:users <repo-name>.git
    cd <repo-name>.git
    git update-server-info
    ```

    NOTE: I'm not entirely sure if `git update-server-info` must be run for each repo or just initially. It seems to work without running this command, but I'm suspcicious that it might cause problems later.

    ### Add NAS as Remote for Local Repo

    - Clone repo from NAS

    ```
    git clone ssh://[email protected]/volume1/git/<repo-name>.git
    ```
    thử:
    ```
    git clone ssh://[email protected]:5006/git/<repo-name>.git
    git clone ssh://[email protected]:port/volume1/git/<repo-name>.git
    ```
    ## Khởi tạo git trên server
    ```
  13. ngoviet revised this gist Oct 23, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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`
    `vara:x:1026:100::/var/services/homes/vara:/var/packages/Git/target/bin/git-shell`
    -------------->
    ###-------------->
    `vara:x:1026:100::/var/services/homes/vara:/bin/sh`
    ### Cấu hình người dùng và thư mục git

  14. ngoviet revised this gist Oct 23, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -11,13 +11,13 @@ vi /etc/passwd
    `vara:x:1026:100::/var/services/homes/vara:/var/packages/Git/target/bin/git-shell`
    -------------->
    `vara:x:1026:100::/var/services/homes/vara:/bin/sh`
    ### Set Up User and Folder
    ### Cấu hình người dùng và thư mục git

    - Tạo người dùng `gituser` cùng với File Station và WebDAV privilages
    - Thêm thư mục mới `git` (ở `/volume1/git`) với quyền read/write cho `gituser` and `admin`. Đây là thư mục chứa các repos.
    - Install Git Server package via Diskstation
    - Open Git Server and allow `gituser` permissions
    - Enable SSH access on Diskstation (Control Panel > Terminal & SNMP > Enable SSH Service)
    - Cài đặt gói `Git Server`
    - Mở `Git Server` và cấp quyền cho `gituser`
    - Mở truy cập SSH (Control Panel > Terminal & SNMP > Enable SSH Service)

    ### Configure SSH Access

  15. ngoviet revised this gist Oct 23, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -13,8 +13,8 @@ vi /etc/passwd
    `vara:x:1026:100::/var/services/homes/vara:/bin/sh`
    ### Set Up User and Folder

    - Create user `gituser` via Diskstation interface (with File Station and WebDAV privilages)
    - Add new shared folder called `git` (located at `/volume1/git`) with read/write access for `gituser` and `admin`. This folder will hold all the repos.
    - Tạo người dùng `gituser` cùng với File Station WebDAV privilages
    - Thêm thư mục mới `git` (`/volume1/git`) với quyền read/write cho `gituser` and `admin`. Đây là thư mục chứa các repos.
    - Install Git Server package via Diskstation
    - Open Git Server and allow `gituser` permissions
    - Enable SSH access on Diskstation (Control Panel > Terminal & SNMP > Enable SSH Service)
  16. ngoviet revised this gist Oct 20, 2015. No changes.
  17. ngoviet revised this gist Oct 19, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ vi /etc/passwd
    - Người dùng có shell: `/sbin/nologin` khô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`
    `vara:x:1026:100::/var/services/homes/vara:/var/packages/Git/target/bin/git-shell`
    đổi thành:
    -------------->
    `vara:x:1026:100::/var/services/homes/vara:/bin/sh`
    ### Set Up User and Folder

  18. ngoviet revised this gist Oct 19, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -8,6 +8,9 @@ vi /etc/passwd
    ```
    - Người dùng có shell: `/sbin/nologin` khô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`
    `vara:x:1026:100::/var/services/homes/vara:/var/packages/Git/target/bin/git-shell`
    đổi thành:
    `vara:x:1026:100::/var/services/homes/vara:/bin/sh`
    ### Set Up User and Folder

    - Create user `gituser` via Diskstation interface (with File Station and WebDAV privilages)
  19. ngoviet revised this gist Oct 19, 2015. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@ sửa
    ```
    vi /etc/passwd
    ```
    Người dùng có shell: `/sbin/nologin` khô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`
    - Người dùng có shell: `/sbin/nologin` khô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`
    ### Set Up User and Folder

    - Create user `gituser` via Diskstation interface (with File Station and WebDAV privilages)
  20. ngoviet revised this gist Oct 19, 2015. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,13 @@
    Configure Synology NAS as Git Server
    ------------------------------------

    Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

    ### Cho phép SSH
    sửa
    ```
    vi /etc/passwd
    ```
    Người dùng có shell: `/sbin/nologin` khô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`
    ### Set Up User and Folder

    - Create user `gituser` via Diskstation interface (with File Station and WebDAV privilages)
  21. ngoviet revised this gist Sep 27, 2015. No changes.
  22. ngoviet revised this gist Sep 27, 2015. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion Synology-Git-Cmd.md
    Original file line number Diff line number Diff line change
    @@ -91,7 +91,9 @@ echo libs >> .gitignore
    ## Xử lý lỗi Cập nhật .gitignore mà tracking vẫn không update
    Xóa cache của git
    ```
    git rm -r --cached
    git rm -r --cached .
    git add .
    git commit -m "fixed untracked files"
    ```
    ## References

  23. ngoviet renamed this gist Sep 27, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  24. ngoviet revised this gist Sep 27, 2015. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -81,6 +81,13 @@ git commit -m "Khoi tao"
    git remote add origin ssh://[email protected]:2222/volume1/git/<repo-name>.git
    git push origin master
    ```
    ## Tạo file .gitignore và cập nhật
    ```
    type NUL > .gitignore
    echo bower_components > .gitignore
    echo node_modules >> .gitignore
    echo libs >> .gitignore
    ```
    ## Xử lý lỗi Cập nhật .gitignore mà tracking vẫn không update
    Xóa cache của git
    ```
  25. ngoviet revised this gist Sep 27, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -81,6 +81,11 @@ git commit -m "Khoi tao"
    git remote add origin ssh://[email protected]:2222/volume1/git/<repo-name>.git
    git push origin master
    ```
    ## Xử lý lỗi Cập nhật .gitignore mà tracking vẫn không update
    Xóa cache của git
    ```
    git rm -r --cached
    ```
    ## References

    http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html
  26. ngoviet revised this gist Sep 27, 2015. 1 changed file with 5 additions and 0 deletions.
    5 changes: 5 additions & 0 deletions Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,11 @@ thử:
    ```
    git clone ssh://[email protected]:5006/git/<repo-name>.git
    ```
    ## Khởi tạo git trên server
    ```
    cd volume1/git
    git --bare init <repo-name>.git
    ```
    ## Đẩy project có sẵn lên git
    ```
    git init
  27. ngoviet revised this gist Sep 27, 2015. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -68,6 +68,14 @@ thử:
    ```
    git clone ssh://[email protected]:5006/git/<repo-name>.git
    ```
    ## Đẩy project có sẵn lên 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
    ```
    ## References

    http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html
  28. ngoviet revised this gist Sep 23, 2015. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -64,8 +64,10 @@ NOTE: I'm not entirely sure if `git update-server-info` must be run for each rep
    ```
    git clone ssh://[email protected]/volume1/git/<repo-name>.git
    ```
    thử clone ssh://[email protected]:5006/git/<repo-name>.git

    thử:
    ```
    git clone ssh://[email protected]:5006/git/<repo-name>.git
    ```
    ## References

    http://blog.osdev.org/git/2014/02/13/using-git-on-a-synology-nas.html
  29. ngoviet revised this gist Sep 22, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -64,7 +64,7 @@ NOTE: I'm not entirely sure if `git update-server-info` must be run for each rep
    ```
    git clone ssh://[email protected]/volume1/git/<repo-name>.git
    ```

    thử clone ssh://[email protected]:5006/git/<repo-name>.git

    ## References

  30. @walkerjeffd walkerjeffd revised this gist Jul 17, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Synology-Diskstation-Git.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    Configure Synology NAS as Git Server
    ------------------------------------

    Instructions for setting up a git server on a Synology NAS with Diskstation
    Instructions for setting up a git server on a Synology NAS with Diskstation. Specifically, I am using a DS414 with DSM 5.0.

    ### Set Up User and Folder