troubleshooting.mdx 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. ---
  2. title: "Troubleshooting"
  3. description: "Common issues and their solutions when running Gogs"
  4. icon: "wrench"
  5. ---
  6. This page covers common problems you may encounter when installing, configuring, or running Gogs, organized by category.
  7. ## SSH
  8. <AccordionGroup>
  9. <Accordion title="SSH connection hangs for 60 seconds">
  10. **Possible cause**: Gogs makes an HTTP request back to its own web service after every SSH push. If the server firewall or ISP blocks this loopback connection, the request will hang until it times out.
  11. **Solution**: Ensure that the server can reach itself on the configured HTTP port. Check firewall rules and any network policies that may prevent loopback connections.
  12. </Accordion>
  13. <Accordion title="Incorrect binary path for update hook">
  14. **Possible cause**: You moved the Gogs binary to a different location from where it was originally installed, so the Git hooks reference a stale path.
  15. **Solution**: Go to the **Admin Panel** (`/admin`) and run these two tasks:
  16. 1. **Rewrite `.ssh/authorized_keys` file**
  17. 2. **Resync pre-receive, update and post-receive hooks of all repositories**
  18. </Accordion>
  19. <Accordion title="Push succeeds but the dashboard timeline does not update">
  20. **Possible cause**: When using Git over SSH, Gogs relies on hook scripts to update the timeline and repository display. Several conditions can prevent these scripts from executing, especially when repositories are stored on a mounted device.
  21. **Solution**:
  22. - Ensure the mount point containing the repositories is **not** set as `noexec`. Run `mount` to check, and if necessary add the `exec` option to the mount point in `/etc/fstab`.
  23. - For `vfat` (and possibly `cifs`) mounts, ensure the `uid`, `gid`, and `fmask` options permit the Gogs user (or a group it belongs to) to execute files.
  24. - For network-mounted shares (NFS, Samba), ensure the server is not configured to disallow execution on the remote filesystem.
  25. </Accordion>
  26. </AccordionGroup>
  27. ## Git
  28. <AccordionGroup>
  29. <Accordion title="Public key conflict: 'does not appear to be a git repository'">
  30. **Error**:
  31. ```text
  32. fatal: 'XX/XX.git' does not appear to be a git repository
  33. ```
  34. Or: pushed commits but the repository still shows as bare.
  35. **Possible cause**: There are duplicate SSH keys in `~/.ssh/authorized_keys`. This commonly happens if you are (or were) running GitLab on the same system user.
  36. **Solution**: Edit `~/.ssh/authorized_keys` and remove the old duplicate entry, keeping only the key that was added by Gogs.
  37. </Accordion>
  38. <Accordion title="Cannot call 'git' command by Gogs">
  39. **Error**:
  40. ```text
  41. repo.NewRepoContext(fail to set git user.email):
  42. ```
  43. **Possible cause**: On Windows, this occurs when Git Bash was installed without enabling the `cmd` option, so `git` is not available on the system PATH.
  44. **Solution**: Reinstall Git for Windows and make sure the option to add Git to the system PATH (the `cmd` option) is enabled.
  45. </Accordion>
  46. </AccordionGroup>
  47. ## Database
  48. <AccordionGroup>
  49. <Accordion title="Incorrect MySQL storage engine (key too long)">
  50. **Error**:
  51. ```text
  52. Error 1071: Specified key was too long; max key length is 1000 bytes
  53. ```
  54. **Possible cause**: The database is using the MyISAM storage engine, which has a shorter maximum key length than InnoDB.
  55. **Solution**: After importing the initial schema, log into MySQL and switch the storage engine:
  56. ```sql
  57. USE gogs;
  58. SET GLOBAL storage_engine=INNODB;
  59. ```
  60. Then re-run the Gogs installer at `http://localhost:3000/install`.
  61. </Accordion>
  62. <Accordion title="Outdated MySQL password authentication">
  63. **Error**:
  64. ```text
  65. Database setting is not correct: This server only supports the insecure old password authentication.
  66. ```
  67. **Possible cause**: The MySQL user's password was only updated for the `@localhost` entry. A second entry in the user table (such as `@%`) still has the old-format password.
  68. **Solution**: Update the password for all host entries of the MySQL user. See [this GitHub discussion](https://github.com/gogs/gogs/issues/385#issuecomment-54357073) for detailed steps.
  69. </Accordion>
  70. <Accordion title="Wrong SQLite3 database file">
  71. **Error**: Pushing to a repository shows that the owner is not registered, or the `user` table does not exist.
  72. **Possible cause**: Gogs may be running as a system service and loading a different SQLite3 file than expected (for example, a relative path resolved differently).
  73. **Solution**: Use an **absolute path** for the SQLite3 database file in your `custom/conf/app.ini` configuration.
  74. </Accordion>
  75. </AccordionGroup>
  76. ## Email
  77. <AccordionGroup>
  78. <Accordion title="Gmail error 534: 'Please log in via your web browser'">
  79. **Possible cause**: Google does not trust the server sending the email and requires additional verification.
  80. **Solution**:
  81. 1. Visit [https://accounts.google.com](https://accounts.google.com) and log in.
  82. 2. Go to [https://accounts.google.com/DisplayUnlockCaptcha](https://accounts.google.com/DisplayUnlockCaptcha) and click **Continue**.
  83. 3. Copy the `ContinueSignIn` link from the Gogs server log and complete the sign-in.
  84. 4. Check your spam folder in case your mail provider flagged the messages.
  85. </Accordion>
  86. <Accordion title="Authentication failed (error 535)">
  87. **Error**:
  88. ```text
  89. gomail: could not send email 1: Auth: 535
  90. ```
  91. **Possible cause**: The SMTP password contains special characters that are not being interpreted correctly.
  92. **Solution**: Wrap the password in single quotes in your `custom/conf/app.ini`:
  93. ```ini
  94. PASSWORD = 'P4§$w0rd'
  95. ```
  96. </Accordion>
  97. </AccordionGroup>
  98. ## Windows
  99. <AccordionGroup>
  100. <Accordion title="Cygwin path conflict">
  101. **Error**:
  102. ```text
  103. cygwin warning: MS-DOS style path detected ...
  104. fatal: '/cygdrive/d/.../C:\Users\...' does not appear to be a git repository
  105. ```
  106. **Possible cause**: Another shell (such as Cygwin) is installed on the system and its path style conflicts with the native Windows paths Gogs expects.
  107. **Solution**: Start Gogs using the default Windows Command Prompt (`cmd.exe`) instead of Cygwin or other alternative shells.
  108. </Accordion>
  109. <Accordion title="CSS loaded with wrong MIME type">
  110. **Error**:
  111. ```text
  112. Resource interpreted as Stylesheet but transferred with MIME type application/x-css
  113. ```
  114. **Possible cause**: The Windows registry has an incorrect `Content Type` value for the `.css` file extension.
  115. **Solution**: Open the Windows Registry Editor, navigate to `HKEY_CLASSES_ROOT\.css`, and change the `Content Type` value to `text/css`.
  116. </Accordion>
  117. </AccordionGroup>
  118. ## Other
  119. <AccordionGroup>
  120. <Accordion title="Extremely slow page response despite low reported render time">
  121. **Possible cause**: This can happen for two reasons:
  122. 1. Nginx is trying to resolve `localhost` as an IPv6 address, causing a delay.
  123. 2. Gravatar avatar lookups are being attempted without a valid email address.
  124. **Solution**:
  125. 1. Use the explicit hostname `127.0.0.1` instead of `localhost` during the initial setup at `http://gogs-server:3000/install`.
  126. 2. Either use a valid Gravatar email address for the administrator account or disable avatar lookup during the initial setup.
  127. </Accordion>
  128. <Accordion title="Duplicate entry for SSH key name">
  129. **Error**:
  130. ```text
  131. Error 1062: Duplicate entry 'Unknown-Mac' for key 'UQE_public_key_name'
  132. ```
  133. **Possible cause**: A very early version of Gogs had a unique constraint (`UQE_public_key_name`) on SSH key names in the `public_key` table. This constraint is no longer needed.
  134. **Solution**: Manually delete the `UQE_public_key_name` unique index from the `public_key` table in your database.
  135. </Accordion>
  136. <Accordion title="GLIBC_2.14 not found">
  137. **Solution**: Update the C library on your system:
  138. ```bash
  139. sudo apt-get -t testing install libc6-dev
  140. ```
  141. </Accordion>
  142. <Accordion title="Permission denied when creating session data directory">
  143. **Error**:
  144. ```text
  145. [Macaron] PANIC: session(start): mkdir data: permission denied
  146. ```
  147. **Possible cause**: Gogs creates a `data` subdirectory in the same directory as the Gogs binary. The process does not have write permission to that directory.
  148. **Solution**: Ensure the user running Gogs has permission to create subdirectories in the directory where the Gogs binary is located.
  149. </Accordion>
  150. <Accordion title="remote rejected: hook declined">
  151. **Error**:
  152. ```text
  153. ! [remote rejected] master -> master (hook declined)
  154. ```
  155. **Possible cause**: Git is unable to execute the update hook script.
  156. **Solution**: Make sure the `bash` shell is available on your system. All Gogs hook scripts require `bash` to run.
  157. </Accordion>
  158. </AccordionGroup>