Gitlab Error - Repository doesn't exist - ruby-on-rails

I had installed gitlab 6 a month ago, there was no problem and all was working fine, until recently it started showing me the following error, when I push into a newly created repository it gives me the following error:
fatal: '/home/git/repositories/my_username/tester.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
Output of git remote -v is as follows:
origin git#my_server.com:username/tester.git (fetch)
origin git#my_server.com:username/tester.git (push)
I also have no issue in pulling and pushing to my old repositories that are in gitlab.
What could be causing this?
Thanks

When you create a project in Gitlab - Gitlab adds a job to the queue to create a repository in the directory where the repository is stored. This operation is performed asynchronously by reason of the fact that for its implementation meets the component gitlab-shell. You can see the logs of his work (ex /home/git/gitlab-shell/gitlab-shell.log) in order to learn more details about a potential problem, but if it worked before - hardly something went wrong there.
Most likely your problem is related to the fact that the queue was either loaded or was not started or did not work correctly. Restarting of Sidekiq solves this problem. You can restart it by running the command:
bundle exec rake sidekiq:restart

Related

Puppet Code Manager setup issue with Bitbucket

I have just installed puppet server enterprise and successfully added a few nodes and got some custom modules running also. I am now wanting to move to Code Manager before we get too deep in it.
I have followed the instructions for creating an empty Bitbucket repo here and initializing it with one single file environment.conf on a production branch as described in that link.
I have then followed the steps here to configure Code Manager but when I get to Test the control repository section to test the connection with puppet-code deploy --dry-run I get the following error:
--dry-run implies --all.
--dry-run implies --wait.
Dry-run deploying all environments.
2021/12/21 20:21:12 ERROR - [POST /deploys][500] Errors while collecting a list of environments to deploy (exit code: 1).
"/opt/puppetlabs/puppet/lib/ruby/gems/2.7.0/gems/rugged-0.27.7/lib/rugged/repository.rb:258: warning: Using the last argument as keyword parameters is deprecated\nERROR\t -\u003e Unable to determine current branches for Git source 'puppet' (/etc/puppetlabs/code-staging/environments)\nOriginal exception:\nFailed to authenticate SSH session: Unable to send userauth-publickey request at /opt/puppetlabs/server/data/code-manager/git/git#git.company.com-1234-in-puppet-control-repo.git\n"
I have added the puppet server's SSH pub key to the bitbucket repo's access tokens.
There are a few things in that error message im not fully understanding.
Unable to determine current branches for Git source 'puppet' - What is meant by source 'puppet' - my repo is called puppet-control-repo...?
Failed to authenticate SSH session: Unable to send userauth-publickey request - My puppet master's SSH keys are in the token list for that repo so confused here also.
Any guidance would be appreciated.
UPDATE (13-01-2022):
I can successfully clone on puppet server using command
git clone ssh://git#git.example.com:1234/project/puppet-control-repo.git --config core.sshCommand="ssh -i /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa"
Note sure why puppet is still returning:
Failed to authenticate SSH session: Unable to send userauth-publickey request
I don't know if you saw the instructions here https://puppet.com/docs/pe/2021.4/control_repo.html#managing_environments_with_a_control_repository but you can run
puppet infrastructure configure
which makes sure the files have right permissions.
I would also test attempting a clone with keys works outside of code deploy
git clone -i /etc/puppetlabs/puppetserver/ssh/id-control_repo.rsa your_gir_url
If this works it may be worth being aware of an issue we experienced on github https://puppet.com/blog/how-githubs-protocol-changes-impact-your-puppet-code-deployments/ which depending on bitbuckets approach to protocal may be having a similar affect.
We are updating docs to recommend the usage of more secure keys ed25519 creating as per the article.
if a manual clone doesnt work it suggests bitbucket doesn't have your public key correctly
Also a more complete debugging command is
runuser -u pe-puppet -- /opt/puppetlabs/puppet/bin/r10k -c /opt/puppetlabs/server/data/code-manager/r10k.yaml deploy environment production --puppetfile --verbose debug2
FOLLOWUP
On investigation we found https://support.puppet.com/hc/en-us/articles/227829007 which showed ssh:// was required at the start of r10k_remote making an example command of ssh://git#bitbucket.org:davidsandilands/control-repo.git
I have requested updates to https://support.puppet.com/hc/en-us/articles/227829007 to highlight this is not a version confined issue and asked for the puppet code manager configuration docs to be updated to reflect this may be required.
I see that you have a .pub file in the ssh directory. I believe it's expecting a private key there.
Also do you have the master class set up to point to your repo inside of Puppet Enterprise web ui?
You'll want to set the following parameters on that class.
code_manager_auto_configure = true
r10k_private_key = $PRIVATE_KEY_IN_SSH_FOLDER_ABSOLUTE_PATH
r10k_remote = Your git URL
The PE Master can be found in Node Groups on the PE Web UI Node Groups -> PE Infrastructure -> PE Master
Thanks to #david-sandilands for helping me resolve this and guiding me to this article via the puppet community slack. Top guy!
EDIT 1:
The solution was documented here: https://support.puppet.com/hc/en-us/articles/227829007-Fix-your-Bitbucket-Stash-Code-Manager-configuration-in-Puppet-Enterprise-2015-3-to-2017-2
However the documentation was out of date as it affected version 2021.4 also.
In short:
r10k_remote = "ssh://git#git.company.com:1234/project/control-repo.git"
Not
r10k_remote = "git#git.company.com:1234/project/control-repo.git"
When working with Bitbucket Server.
EDIT 2:
Puppet have since updated their documentation:
https://puppet.com/docs/pe/2021.5/code_mgr_config.html#code_mgr_enable

Why is my app not pushing to bitbucket? (Michael Hartl's tutorial chapter 3 section 3.1)

I am following Michael Hartl's tutorial (chapter 3 section 3.1 https://www.railstutorial.org/book/static_pages) using cloud 9 IDE and trying to push the sample_app to bitbucket. When I type the following command into cloud 9 IDE:
Since we’ll be using this sample app throughout the rest of the book,
it’s a good idea to create a new repository at Bitbucket and push it
up:
$ git remote add origin git#bitbucket.org:/sample_app.git $
git push -u origin --all # pushes up the repo and its refs for the
first time
I get the following error
fatal: remote origin already exists.
(NOTE: I have changed username to my username).
Since I got the error I have tried several solutions including deleting everything from bitbucket fromt he previous exercises in the book. so far i have followed the instructions to the letter, although I did accidentally close some of the tabs in the command line on cloud 9 and I don't know if this made any difference. I also notice that nothing seems to have been created on git even though i did git init, git add -A and git commit. What have I missed. help is greatly appreciated so I can move on. Please let me know if there are any files I should add to an edit of this post. Thanks.
fatal: remote origin already exists.
The remote you're trying to add already exists. Run git remote -v and check in the ouput it gives to you, if is there, then skip the first command and pass the second one to push.

git push heroku master error: Could not read

I tried looking through some git push heroku master errors on this website, but I couldn't find one with my specific problem. Hopefully you guys can help me.
When I run git push heroku master
error: Could not read 6f2abfc273544edc8fa8fbf18837a9ecec606bb2
fatal: bad tree object 6f2abfc273544edc8fa8fbf18837a9ecec606bb2
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'https://git.heroku.com/still-harbor-74893.git'
fatal: write error: Bad file descriptor`
I've read that Heroku sets a hard limit on file sizes, is that the problem?
Check whether your github file is corrupted or not. Or maybe one of the file is corrupted. I can't think of anything else that might be the problem here.
I'm guessing that your repository/current directory is broken. If you think that your current working directory contains uncorrupted files, then you can always re-initialize Git in your working directory. For example:
rm -rf .git
git init
git add .
git commit -m 'Re-initialize repo.'
And then try to push to heroku.

CircleCI - Git could not resolve host when cloning repository

When running npm install within circleci we fetch some node packages from our github repositories through package.json. This operation is happening when building a docker image from a Dockerfile.
This has been working great until last week when without changes in our side, we started to get errors while cloning these packages. To perform this operation, we were using Basic Authentication in the URL providing user credentials in it. For ie:
https://<username>:<password>#github.com/elektron-technogoly/<repository>.git
Now, we get the following errors:
npm ERR! Command failed: git clone ...
npm ERR! fatal: unable to access 'https://<username>:<password>#github.com/elektron-technogoly/<repository>.git':
Could not resolve host: <username>
From the error message it seems like it thinks the username is the host and thus, fails. I checked that password is still valid and it did not expire.
Has recently - around last week - something changed that could cause this error? Has Basic Authentication been disabled?
UPDATE: Playing a bit seems like when you change the base docker image (say from node:4-slim to node:4), the first time it works, subsequent times don't. Unfortunately, logs are not giving me any lead, both look exactly the same but the error appears from the first onwards.

GitlabHQ - W denied for rails

At work I've been tasked with setting up out GIT server with a front end and I found GitlabHQ which looks amazing.
I've installed it all semi-successfully but I cannot push my repos at all as it says I need to push them.
Since I've never used GitLabHQ before first is:
You should push repository to proceed.
After push you will be able to browse code, commits etc.
Normal when adding projects?
and every-time I run
git push -u origin master
I get this,
W access for focus DENIED to rails
(Or there may be no repository at the given path. Did you spell it correctly?)
fatal: The remote end hung up unexpectedly
is anyone able to help since I can't expect the team to keep SSH'ing?
Thanks.
EDIT:
Server = Ubuntu Server 11.10 fully updated and I followed these instructions: https://github.com/gitlabhq/gitlabhq/wiki/V2.0-easy-setup-for-ubuntu
This was fixed by re-running the install (It must have failed silently the first time) and killing the process once it had started with
lsof -p :3000
kill 9 {Whatever the PID was returned from above}
Then re-running the bundle (differs between production or not) I use this
bundle exec rails s -e production -d

Resources