I installed gitlab 8.2.0 from source and followed the instructions on https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/install/installation.
When I run the checks with
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production
I get the following error:
Running /home/git/gitlab-shell/bin/check
Check GitLab API access: FAILED. code: 301
gitlab-shell self-check failed
Try fixing it:
Make sure GitLab is running;
Check the gitlab-shell configuration file:
sudo -u git -H editor /home/git/gitlab-shell/config.yml
Please fix the error above and rerun the checks.
Checking GitLab Shell ... Finished
Here is my config.yml file from /home/git/gitlab-shell:
user: git
gitlab_url: "http://www.example.com/gitlab"
http_settings:
#ca_path: /etc/ssl/certs
self_signed_cert: true
repos_path: "/home/git/repositories/"
auth_file: "/home/git/.ssh/authorized_keys"
redis:
bin: "/usr/bin/redis-cli"
namespace: resque:gitlab
socket: "/var/run/redis/redis.sock"
log_level: INFO
audit_usernames: false
Note that I am using the relative URL feature to run gitlab on www.example.com/gitlab. Also the server is behind a reverse proxy that terminates https to http if this should be of any relevance for this problem.
I also cant' push or pull any repositories. When I try to I get the following error:
git pull https://www.example.com/gitlab/test/testproject.git
Username for 'https://www.example.com': test
Password for 'https://test#www.example.com':
fatal: Couldn't find remote ref HEAD
Unexpected end of command stream
I also can't add any files to any project via the webUI. If I try to do so I get the following error
Commit was rejected by pre-receive hook
The log for this from production.log looks as follows:
Sarted POST "/gitlab/test/testprojekt/create/master" for 147.86.8.115 at 2015-11-26 15:24:43 +0100
Processing by Projects::BlobController#create as JSON
Parameters: {"new_branch"=>"master", "create_merge_request"=>"1", "commit_message"=>"test", "file"=># <ActionDispatch::Http::UploadedFile:0x007f776230faf8 #tempfile=# <Tempfile:/tmp/RackMultipart20151126-7584-308za1>, #original_filename="test2.txt", #content_type="text/plain", #headers="Content- Disposition: form-data; name=\"file\"; filename=\"test2.txt\"\r\nContent-Type: text/plain\r\n">, "namespace_id"=>"test", "project_id"=>"testprojekt", "id"=>"master"}
Completed 200 OK in 628ms (Views: 0.3ms | ActiveRecord: 3.3ms)
Started GET "/gitlab/test/testprojekt/new/master" for 147.86.8.115 at 2015-11-26 15:24:44 +0100
Processing by Projects::BlobController#new as HTML
Parameters: {"namespace_id"=>"test", "project_id"=>"testprojekt", "id"=>"master"}
Completed 200 OK in 85ms (Views: 49.6ms | ActiveRecord: 6.0ms)
I think you could try switching gitlab_url: "http://www.example.com/gitlab" to https -> gitlab_url: "https://www.example.com/gitlab"
Not sure if its a complete fix but its a recomendations.
EDIT:
config.yml line 4 should look like
ca_path: "/etc/ssl/certs"
Related
I try to use Gitlab CI / CD with GilLab Runner for the first time. GitLab is a self-hosted version.
I have a git project in GitLab. By default users must use SSH with private key to use git commands.
But I would like to specify that access control is set to both : SSH and HTTPS.
For this project I create a simple .gitlab-ci.yml file (with a single test step) and a GitLab runner using the token specify by GitLab.
When I run the job, the following error occurs :
Running with gitlab-runner 12.1.0 (de7731dd)
on BK_runner_Test3 hcVfxLhx
Using Shell executor...
Running on ns344345...
Fetching changes...
Reinitialized existing Git repository in /home/gitlab-runner/builds/hcVfxLhx/0/XXXXXXXXX/test/.git/
fatal: unable to access 'https://gitlab-ci-token:[MASKED]#gitlab.xxxxxxxx.com/XXXXXXXX/test.git/': The requested URL returned error: 500
ERROR: Job failed: exit status 1
Finally, in the Apache logs, I found a request with error 401 and 500.
So, I think, at that time, the job try to clone the project. So I try the following command :
git clone https://gitlab-ci-token:[MASKED]#gitlab.xxxxxxxx.com/XXXXXXXX/test.git/
And the result is an error 401 !
Of course [MASKED] was replaced with the right token, used to declare tue runner.
So why this error 401 ? What did I miss in the configuration in order to authorize jobs using git commands ?
More information from log file /var/log/gitlab/gitlab-rails/production.log
Started GET "/XXXXXXXX/test.git/info/refs?service=git-upload-pack" for 111.222.333.444 at 2019-08-08 15:39:05 +0200
Processing by Projects::GitHttpController#info_refs as */*
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"XXXXXXXX", "project_id"=>"test.git"}
Filter chain halted as :authenticate_user rendered or redirected
Completed 401 Unauthorized in 15ms (Views: 0.7ms | ActiveRecord: 1.4ms | Elasticsearch: 0.0ms)
Started GET "/XXXXXXXX/test.git/info/refs?service=git-upload-pack" for 111.222.333.444 at 2019-08-08 15:39:05 +0200
Processing by Projects::GitHttpController#info_refs as */*
Parameters: {"service"=>"git-upload-pack", "namespace_id"=>"XXXXXXXX", "project_id"=>"test.git"}
Completed 500 Internal Server Error in 12ms (ActiveRecord: 3.0ms | Elasticsearch: 0.0ms)
JWT::DecodeError (Nil JSON web token):
It looks like the Git request is being authenticated/authorized correctly in GitLab Rails, but when it's passed over to GitLab Workhorse to actually send the data to the client, some authorization fails.
Check workhorse logs to see if there's more information. That will be in /var/log/gitlab/gitlab-workhorse/ by default in an Omnibus installation. I'm not exactly sure what would cause this but for some reason the header that authorizes workhorse isn't present.
Make sure your GitLab version is reasonably close to your runner version. I see you're running Runner 12.1 so GitLab should also be 12.1.
I'm facing the problem with Jenkins with fetching git repo on Linux. I attach the stack trace. I have SSH gitlab connection configured with a private key and a passphrase. The configuration is made in Credentials/System/Global credentials (unrestricted). The path to the private key is /home/jenkins/.jenkins/secrets/my_private_key.pub. Owner and a group: jenkins:jenkins, where jenkins is the user making the installation. Permissions: 600.
The private key has been checked with the passphrase using ssh from the command line. The git fetch command used by jenkins has also been checked with command line. Both works.
Repository URL format is like:
git#github.com:org-name/project.git (short notation for ssh protocol)
Environment:
* CentOS 7 64 bit
* openjdk version "1.8.0_131" 64 bit
* Jenkins ver. 2.67
* Git client plugin 2.4.6Git plugin 3.3.0 (3.3.1 is not helping too)
* GIT server Plugin 1.7
* GitLab Plugin 1.4.5 (1.4.6 is not helping too)
* SCM API Plugin 2.1.1
* Credentials Plugin 2.1.14
* Jenkins is run directly
* Jenkins was installed with yum installer
* Browser: Google Chrome 59
* GitLab Community Edition 9.3.5
* git version 1.8.3.1
Stack trace:
started by user Jenkins Admin
Building in workspace /home/jenkins/.jenkins/workspace/my_project
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url git#gitlab.repo:XYZ/docs/project.git #
timeout=10
Cleaning workspace
> git rev-parse --verify HEAD # timeout=10
No valid HEAD. Skipping the resetting
> git clean -fdx # timeout=10
Fetching upstream changes from git#gitlab.repo:XYZ/docs/project.git
> git --version # timeout=10
using GIT_SSH to set credentials
> git fetch --no-tags --progress git#gitlab.repo:XYZ/docs/project.git
+refs/heads/*:refs/remotes/origin/* --depth=1
ERROR: Timeout after 10 minutes
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from git#gitlab.repo:XYZ/docs/project.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:809)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1076)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1107)
at hudson.scm.SCM.checkout(SCM.java:495)
at hudson.model.AbstractProject.checkout(AbstractProject.java:1212)
at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:560)
at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:485)
at hudson.model.Run.execute(Run.java:1735)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:415)
Caused by: hudson.plugins.git.GitException: Command "git fetch --no-tags --progress git#gitlab.repo:XYZ/docs/project.git +refs/heads/*:refs/remotes/origin/* --depth=1" returned status code 143:
stdout:
stderr:
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:1903)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1622)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$300(CliGitAPIImpl.java:71)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:348)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:807)
... 11 more
ERROR: null
Finished: FAILURE
I found a solution. Running Jenkins as a service with systemctl resolved the problem, instead of running Jenkins with java -jar jenkins.war.
To give more details:
According to the documentation, Jenkins is started by
java -jar jenkins.war
And it was visible as running in the system when I checked it with:
ps aux | grep jenkins
However, on CentOS 7 the suggested way of running Jenkins is to run it as a daemon with systemctl command.
When I checked it with
sudo systemctl status jenkins.service
it was inactive.
So I started Jenkins with
sudo systemctl start jenkins.service
and it worked.
I tried to deploy the Hexo on my GithubPage.
The generate process looks fine, but error happens when I deploy it on my GithubPage.
Here's the deployment part in _config.yml:
# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: https://github.com/ZhangYuef/ZhangYuef.github.io.git
# branch: Hexo
Generate
Deployment
So what's going on there?
Thx for help! :)
The context you provided in the question is not sufficient...
But according to invalid chars on the screenshot, I suppose that your Chinese file path may be the cause.
References:
Node JS Error: ENOENT
Why does ENOENT mean "No such file or directory"?
try to update the _config.yml like this:
deploy:
type: git
repository: https://github.com/fakeYanss/fakeYanss.github.io.git
branch: master
yaml is very very very strict, and indent is important!
Not sure what reason causing this error.
Check your environment whether these things have been set up.
I think it might be your config type is wrong.
npm install hexo-deployer-git --save
git repository settings like
deploy:
- type: git
repo: git#github.com:xxx.git
branch: master
- type: git
repo: git#github.com:xxx.git
branch: src
extend_dirs: /
ignore_hidden: false
ignore_pattern:
public: .
By this way, you can not only deploy your blog, but also backup your blog files, which you can use the command git pull to get the blog files on another machine.
- set up your ssh
ssh-keygen -t rsa -C "yourEmail#icloud.com"
ssh-agent -s
chmod id_rsa 600
ssh-add id_rsa
(you need to add the id_rsa.pub to the github's deployer key)
ssh -T git#github.com
sometimes it maybe you have several gits, make deployer confused.
Try delete .git directory and make sure there is no any git in other directories.
encoding. It could be the encoding is different. In my case, I make all the files belong to UTF-8.
By the way, it could be your files' error.try npm install hexo-server --save and hexo server to detect whether the website can be deployed.
(http://localhost:4000/xx)
First of all my gitlab connection was broken by error 500 and 502. The server was unattended for a while. So i decided to reinstall:
#gitlab-ctl cleanse
#apt-get purge gitlab-ce
Installation:
https://about.gitlab.com/downloads/#ubuntu1404
After the gitlab was reachable and i could create a project and clone it.
After i tried to push a new file to my repo and got following message:
git add .
git commit -m "inital"
git push --set-upstream origin master
error: Cannot access URL http://<username>#gitlab.domain.de:<port>/group/project.git/, return code 22
fatal: git-http-push failed
error: failed to push some refs to 'http://<username>#gitlab.domain.de:<port>/group/project.git/'
The gitlab-check gives this information:
#gitlab-rake gitlab:check
everything was green, besides violett ones:
Uploads directory setup correctly? ... skipped (no tmp uploads folder yet)
Init script exists? ... skipped (omnibus-gitlab has no init script)
Init script up-to-date? ... skipped (omnibus-gitlab has no init script)
Why i can clone but not push? I searched in several log-files, but got nothing useful.
I am writing a small app for those in the company who don't like command line and to help with productivity. The app runs a shell script which gets input from the user, uses it to SSH to a remote staging server and git clone the repo to that remote server. SSH keys are all good for the staging server and on Bitbucket. I can manually SSH into the server and git clone without any issue. I have also managed to get it to work going to a live server for initial setup. All other commands sent to the server are working.
The code used for this particular part is:
ssh $SUSER#$SHOST "git clone --depth 1 git#bitbucket.org:team/$SITEADDRESS.git --branch staging $CURRDIR"
I've also tried to run this manually from terminal with the following code:
ssh user#server "GIT_CURL_VERBOSE=1 GIT_TRACE=1 git clone -v --depth 1 git#bitbucket.org:team/repo.git --branch staging /path/to/folder"
This is the output I get:
trace: built-in: git 'clone' '-v' '--depth' '1' 'git#bitbucket.org:team/repo.git' '--branch' 'staging' '/path/to/folder'
Cloning into '/path/to/folder'...
trace: run_command: 'ssh' 'git#bitbucket.org' 'git-upload-pack '\''team/repo.git'\'''
trace: run_command: '--shallow-file' '/path/to/folder/.git/shallow.lock' 'index-pack' '--stdin' '--fix-thin' '--keep=fetch-pack 557 on ubuntu'
trace: exec: 'git' '--shallow-file' '/path/to/folder/.git/shallow.lock' 'index-pack' '--stdin' '--fix-thin' '--keep=fetch-pack 557 on ubuntu'
trace: built-in: git 'index-pack' '--stdin' '--fix-thin' '--keep=fetch-pack 557 on ubuntu'
At this point it just hangs without errors instead of moving on to remote: Counting objects: 4535, done. and cloning the repo.
I've been trying to get this working for quite a few hours now and have been unable to find any info on similar problems. Using Git v1.9.1