GitlabHQ - W denied for rails - ruby-on-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

Related

Pronto-Rubocop on Gitlab is not working, wrong URL being called

I'm using:
Gitlab 7.11.2
Rails 3.2
Pronto 0.4.2
pronto-rubocop 0.4.4
And I'm having trouble setting up the script to run Rubocop on git commits. I want to use Pronto so only the changes are checked. I am not using GitLab to host so I am not sure how to proceed when I reach this point of the Pronto setup, https://github.com/mmozuras/pronto:
Set the GITLAB_API_ENDPOINT environment variable to your API endpoint URL. If you are using Gitlab.com's hosted service your endpoint will be https://gitlab.com/api/v3. Set the GITLAB_API_PRIVATE_TOKEN environment variable to your Gitlab private token which you can find in your account settings.
Then just run it:
GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
Where do I run the last command?:
GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
I created a .gitlab-ci.yml file and it has:
before_script:
- ruby -v
- gem install bundler --no-ri --no-rdoc
- bundle --without postgres
rubocop:
script: bundle exec pronto run --index
But I can't tell if this is running.
I also did not set up GitlabFormatter as it is mentioned on the Pronto page, when I tried looking up information about it was vague and unhelpful to me.
Can someone point me in the right direction?
Thanks!
**UPDATE
So I gave up on using .gitlab-ci.yml file route for now because the job on gitlab-ci worked. I figured out the endpoint and installed all the necessary requirements on the server and everything bundles correctly.
At the very end of the process, I run:
GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
But the URL it generates is incorrect and I cannot add comments to the commit:
https://gitlab.com/api/v3/projects/10022%2Fname%2Fapp-name/repository/commits/ad87234..asdf87923/comments
I'm getting an
(Gitlab::Error::NotFound)
and I looks like it is coming from this part of code:
../10022%2Fname%2Fapp-name/..
because I can see the JSON when I change it to
../name/app-name/..
Any idea on how to call the correct URL?
Finally got this working. I am hosting gitlab on my own server, the API endpoint will look up the correct project as long as you have "api/v3" at the end. It's when you specify projects that things can go wrong, you'll know this if you see errors similar to these:
"Project not found" --> don't specify the project
"Unauthorized" --> are you using the correct user token?
Finally, even after pronto is run and it tells you how many errors were found or how many comments left, it might not always show up on the commit BUT if you submit a merge request the rubocop comments will show up.
To have the gitlab build fail if there are style guide violations run pronto with the option:
--exit-code

Gitlab Error - Repository doesn't exist

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

Error deploying rails app to heroku

I am following the rails tutorial, and I am at a point where it instructs to deploy the app to heroku for the second time. I have successfully deployed an app in the past, but it will not work now.
I get this error : Permission denied (public key)
fatal: could not read from remote repository.
The remote exists and is correct, and when using the "heroku key" my key appears. I can add a new stack to heroku as well. I also tried re-adding the key, and that did not work.
Very confused, all the solutions I have found have not worked.
Sounds like you need to configure your ssh keys (usually located at ~/.ssh). Are you using github? If so, your ssh keys should already be set up (you won't be able to push to github.com without setting those up).
If you haven't already set up your ssh keys, follow these instructions from github to do so.
Once your ssh keys are set up, performing the command 'git push heroku' should do the trick. Make sure Heroku is set up correctly by following the instructions from the tutorial
You are probably not deploying as the same user you deployed the first app as. If you are in a linux environment this probably means you deployed as root one time and tried to as a user the other time, maybe you used sudo .
Or possibly you deleted your ssh public keys....or maybe you changed the permissions of your ssh keys.
I am not high enough rated to comment, so please navigate to ~/.ssh and type "ls -l" so I can see your permissions. Then navigate one directory up to ~/ and type "ls -la" so I can see your permissions on the actual .ssh folder
then navigate to /.ssh and do the same permissions posting so I can see them.

Postgres Server error -> PGError: could not connect to server

I get the error below when trying to start my rails app on the localhost:
PGError (could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
From what I have read it sounds like this is most likely a problem in connecting to the Postgres server, and may indicate that it is not started?
It all started when I was attempting my first (yay noobs!) merge using git. There was a conflict (having to do with the Rubymine workspace.xml file), and I started to open up a conflict resolution program. It then seemed that there was really no need to track workspace.xml at all and so I quit from the resolution program, intending to run "git rm --cached" on the file. I think in quitting the program something went foul, and I ended up restarting, before untracking the file, and then completing the merge. Further evidence that something was gummed up is that my terminal shell didn't open up correctly until I restarted the machine.
Now, as far as I can tell, everything in the merge went fine (there were trivial differences in the two branches anyway), but for the life of me I can't seem to get rid of this PGError. If it is as simple as starting the server, then I'd love help on how to do that.
(other context: OSx, rails 3, posgresql83 installed via macports, pg gem).
EDIT - I have been trying to start up the server, but am not succeeding. e.g., I tried:
pg_ctl start -D /opt/local/var/db/postgresql83/defaultdb
This seems to be the right path for the data (it finds the postgresql.conf file) but the response I get is "cannot execute binary file."
Try sudo port load postgresql83-server - this should work with the latest 8.3 port from macports.
If this doesn't work, try sudo port selfupdate; sudo port upgrade outdated and then try again.
Note - this may take absolutely ages.
and may indicate that it is not started?
Yes, sounds like the server is not running on your local machine.
See the description of this error in the PostgreSQL manual:
http://www.postgresql.org/docs/8.3/static/server-start.html#CLIENT-CONNECTION-PROBLEMS
To start the server, try something along the following lines (adjust for pgsql version # and logfile):
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql8/defaultdb -l /opt/local/var/log/postgresql84/postgres.log start'
To stop the server,
sudo su postgres -c '/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/db/postgresql84/defaultdb stop'

Heroku deployment error

In a windows environment I am getting the following error when trying to deploy to Heroku
C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/base.rb:32:in ': No such file or directory - git
remote (Errno::ENOENT)
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:in shell'
from C:/Ruby/lib/ruby/1.8/fileutils.rb:121:in
chdir'
from C:/Ruby/lib/ruby/1.8/fileutils.rb:121:in
cd'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ba
se.rb:32:inshell'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/commands/ap
p.rb:52:in create'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
48:insend'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
48:in run_internal'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/lib/heroku/command.rb:
20:inrun'
from C:/Ruby/lib/ruby/gems/1.8/gems/heroku-1.9.13/bin/heroku:13
from C:/Ruby/bin/heroku:19:in `load'
from C:/Ruby/bin/heroku:19
Any idea how I can correct this? This is being run from the Ruby Command line (which seems to me like the regular command line)
Ok so I figured out a way to make it work and why it is likely happening.
For some reason I can only run the Ruby commands from the CMD prompt however the GIT commands only seem to work from the GIT Bash. When in the GIT Bash the Ruby commands don't work.
When you run the Heroku commands to create the service it seems to want to run certain GIT commands which don't work from the CMD prompt the way I have it set up.
To get around this for the moment I am adding the Heroku path for GIT as a remote manually and then pushing that manually when needed. An extra step but everything still works as intended.
If you need help with the work around check out the information in this link: http://www.wiki.devchix.com/index.php?title=Working_around_the_%22heroku_create%22_error
I'd still recommend using Git Bash over the normal windows CMD prompt.. but I know how tedious that can be sometimes.
You can bypass the need to do this however and get your Heroku gem working properly in your windows CMD prompt by adding your msysgit/bin path to your system Path variable.
That'll give your heroku gem access to the git command.
To add heroku as remote use the following:
git remote add heroku git#heroku.com:yourappname.git
Then push your master copy to Heroku:
git push heroku master

Resources