Ubuntu 14.04下Jenkins无法识别Mercurial仓库求助
Hey there, let's tackle this Jenkins + Mercurial issue on Ubuntu 14.04 step by step—since you had it working smoothly on Windows, we just need to iron out the Ubuntu-specific kinks.
1. First: Verify Jenkins Mercurial Plugin & System Hg Version Compatibility
- First, check your system's Mercurial version in the terminal:
hg --version - Head to Jenkins > Manage Jenkins > Global Tool Configuration, find the Mercurial section:
- If you're using "System Mercurial", ensure the path matches the output of
which hg(usually/usr/bin/hgfor Ubuntu 14.04). - If you're using "Install automatically", double-check that the plugin supports the Hg version your Ubuntu system can install. Ubuntu 14.04 ships with an older Hg build, so you might need to manually install a compatible version if the plugin requires a newer release.
- If you're using "System Mercurial", ensure the path matches the output of
2. Fix NAS Repository Access & Permissions
Jenkins runs as the jenkins user by default—this is likely where the permission gap is:
- Switch to the jenkins user to test access directly:
sudo -u jenkins bash - Try cloning the NAS repository from this shell:
hg clone <your-NAS-repo-path>- If your NAS is mounted locally (e.g.,
/mnt/nas-hg-repo), check that thejenkinsuser has read/write access:ls -l /mnt/nas-hg-repo # Adjust permissions if needed sudo chmod -R 755 /mnt/nas-hg-repo sudo usermod -aG <nas-mount-group> jenkins - If using a network path (HTTP/SSH/SMB):
- For SSH: Ensure the
jenkinsuser's SSH key is added to the NAS's authorized keys. - For HTTP/SMB: Verify the credentials in Jenkins' SCM config match what the NAS expects, and that the
jenkinsuser can resolve the NAS's IP address.
- For SSH: Ensure the
- If your NAS is mounted locally (e.g.,
3. Correct Jenkins Project Repository Paths
- In your Jenkins project's SCM config (Mercurial section):
- If using your local TortoiseHG-managed repo, use the absolute path (e.g.,
/home/your-username/hg-local-repo), not a relative path. - Note: Your user home directory (
/home/your-username) is usually set to 700 permissions by default, which blocks thejenkinsuser from accessing it. Fix this with:
Or move the repo to a more accessible location likechmod 755 /home/your-username/var/lib/jenkins/repos.
- If using your local TortoiseHG-managed repo, use the absolute path (e.g.,
4. Align TortoiseHG & System Hg Versions
- Check if your TortoiseHG instance is using a custom Hg version (not the system-wide one). Open TortoiseHG's settings and confirm the Hg path matches what you configured in Jenkins. Version mismatches can cause unexpected repository recognition failures.
5. Dig Into Jenkins Logs for Specific Errors
- When a build fails, check the project's build logs or go to Manage Jenkins > System Log for detailed error messages. For example:
- "abort: HTTP Error 403: Forbidden" = NAS permissions are blocking Jenkins
- "abort: repository not found" = Incorrect repo path in Jenkins config
- "permission denied" =
jenkinsuser can't access the local repo or NAS mount
内容的提问来源于stack exchange,提问作者Will
相关产品推荐
相关产品推荐

