New repository, production problem - ruby-on-rails-3

I have a problem with the deployment of the project on the production server. We use Capistrano and Passenger. The problem is that we moved the project repository on GitHub to another account. I changed the repository address in the file deploy.rb, however, during the 'cap production deploy ", after authentication by the production server, Capistrano is looking for an old repository, which fails. I suspect that this is a change in the repository. git on production, but I do not know how to do it.
servers: ["85.xxx.xxx.xxx"]
Password:
[85.xxx.xxx.xx] executing command
** [85.xxx.xxx.xx:: err] ERROR: repo / repo.git does not exist. Did you enter it correctly?
** [85.xxx.xxx.xx:: err] fatal: The remote end hung up unexpectedly
command finished in 4220ms
*** [deploy: update_code] rolling back

Try editing shared/cached-copy/.git/config and modify the git repo listed there. If you're using the remote_cache method, it keeps a local git repo and updates that on the remote machine. Repoint that to your new git repo and you should be good to go.

Related

Using Gitlab deploy keys with write access

I am currently running CE version 8.17.4 and am attempting to setup a deploy key with write access (as of 8.16) so that my runner instance may commit build artifacts back to the repository. I took the following steps to set this up:
On the runner instance, I generated the ssh keypair with the command: 
sudo ssh-keygen -t rsa -C "label" -b 4096
The generated keypair was saved to /home/gitlab-runner/.ssh/id_rsa and password protected.
Within Gitlab, I created a public deploy key from the admin console and pasted the contents of id_rsa.pub into the appropriate field and verified that the key fingerprints matched. I checked the "Write access allowed" box. 
In the private project that I wished to enable repository access from the runner, I enabled the newly created public deploy key.
This is a LaTeX document respository, so in the .gitlab-ci.yml file, I issue the following script after building the pdf:
after_script:
  - "git commit -am 'autobuild PDF'"
  - "git push origin master"
When the changes were committed, the build ran successfully on the runner up until the git push origin master command, and this error was thrown:
fatal: Authentication failed for 'http://gitlab-ci-token:xxxxxxxxxxxxxxxx#host/project.git/'
Ok. A couple questions:
If the deploy key is just an SSH key, shouldn't it be connecting on the secure port or does this matter? I haven't found much documentation on using this new write-permission deploy key feature, so am I missing something in the steps I took above?
Do I need to include [ci skip] in the commit message to avoid looping CI builds? I saw this concern come up in the original issue tickets for this feature, but did not see whether this step was required or not. 
Thanks for any help!
Jawad's comment worked for me: you need to force SSH. for example
git remote add ssh_remote git#host:user/project.git
git push ssh-remote HEAD:dev
thanks jawad

Pull a private repo as a dependency during a dokku deploy?

I am using Dokku on DigitalOcean to deploy my_app.
My app has a dependency which points to a private repo git#github.com:my_org/my_app.git.
Step 10 : RUN <some_command_to_install_deps>
---> Running in ceada9d96c61
* Getting my_repo (git#github.com:my_org/my_app.git)
remote: verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I've tried adding deploy keys using https://github.com/cedricziel/dokku-deployment-keys to no avail. Any help is greatly appreciated.
Along with the deployment keys plugin, you will also need the hostkeys plugin to add github.com to the container's known_hosts file. For example, to approve github.com across all applications on the machine, simply do...
Install the plugin...
dokku plugin:install https://github.com/cedricziel/dokku-hostkeys-plugin.git hostkeys-keys
Then run...
sudo dokku hostkeys:shared:autoadd github.com
If you still face issues after doing this, there is something wrong with your deployment keys setup. In that case, leave a comment and I'll help troubleshoot it

Build from external GIT repo located in networkshare

I have problem to create service connection under TFS2015 Update2.
I have GIT remote REPO located in server and i access it by network share folder in this format:
\\server\GIT_REPOS\GIT_REPO_TO_BUILD_FROM\
I tried add new External GIT REPO Connection under TFS configuration as follow:
Connection name: Git repo
Server url: \\server\GIT_REPOS\GIT_REPO_TO_BUILD_FROM\
UserName: domain\username
Password: userPassword
When I try queue new build i get this error:
Failed to resolve path 'file://server/GIT_REPOS/GIT_REPO_TO_BUILD_FROM/': The filename, directory name, or volume label syntax is incorrect.
Prepare repository failed with exception.
Know someone correct way how to use it with network shared REPO ?
Thanks for help a lot.
According to website https://git-scm.com/book/ch4-1.html, Git supports Local protocol and can use the path to the repository as the URL, but in TFS build, local path isn't supported (I got the same error as you).
As an alternate, you need to publish your repo to a server. Meanwhile, you may consider submit a UserVoice at website https://visualstudio.uservoice.com/forums/121579-visual-studio-2015 to specify the requirement of supporting local git.

How to tag a git repo in a bamboo build

I'm trying to tag the git repo of a ruby gem in a Bamboo build. I thought doing something like this in ruby would do the job
`git tag v#{current_version}`
`git push --tags`
But the problem is that the repo does not have the origin. somehow Bamboo is getting rid of the origin
Any clue?
Yes, if you navigate to the job workspace, you will find that Bamboo does not do a straightforward git clone "under the hood", and the the remote is set to an internal file path.
Fortunately, Bamboo does store the original repository URL as ${bamboo.repository.git.repositoryUrl}, so all you need to do is set a remote pointing back at the original and push to there. This is what I've been using with both basic Git repositories and Stash, creating a tag based on the build number.
git tag -f -a ${bamboo.buildNumber} -m "${bamboo.planName} build number ${bamboo.buildNumber} passed automated acceptance testing." ${bamboo.planRepository.revision}
git remote add central ${bamboo.planRepository.repositoryUrl}
git push central ${bamboo.buildNumber}
git ls-remote --exit-code --tags central ${bamboo.buildNumber}
The final line is simply to cause the task to fail if the newly created tag cannot be read back.
EDIT: Do not be tempted to use the variable ${bamboo.repository.git.repositoryUrl}, as this will not necessarily point to the repo checked out in your job.
Also bear in mind that if you're checking out from multiple sources, ${bamboo.planRepository.repositoryUrl} points to the first repo in your "Source Code Checkout" task. The more specific URLs are referenced via:
${bamboo.planRepository.1.repositoryUrl}
${bamboo.planRepository.2.repositoryUrl}
...
and so on.
I know this is an old thread, however, I thought of adding this info.
From Bamboo version 6.7 onwards, it has the Git repository tagging feature Repository Tag.
You can add a repository tagging task to the job and the Bamboo variable as tag name.
You must have Bamboo-Bitbucket integrated via the application link.
It seems that after a checkout by the bamboo agent, the remote repository url for origin is set as file://nothing
[remote "origin"]
url = file://nothing
fetch = +refs/heads/*:refs/remotes/origin/*
That's why we can either update the url using git remote set-url or in my case I just created a new alias so it does not break the existing behavior. There must be a good reason why it is set this way.
[remote "build-origin"]
url = <remote url>
fetch = +refs/heads/*:refs/remotes/build-origin/*
I also noticed that using ${bamboo.planRepository.<position>.repositoryUrl} did not work for me since it was defined in my plan as https. Switching to ssh worked.

Unable to use egit to clone a repository with ssh

I try to clone a GIT repository with EGit using SSH. I can log on to the machine, see the available branches and choose where to put everything locally. Then when I proceed to actually do the cloning, I get an Eclipse "Problem Occured" box stating:
"Cloning from ssh://[my user name]#[my address] has encountered a problem. ssh://[my user name]#[my address]: Password:". The details for the problem only list "ssh://[my user name]#[my address]: Password:" twice.
The only possible reason I can think of, might be that on the remote compute only Git 1.6.0.x is installed - and I don't have the rights to update it.
Can you clone the repository using native git? If you can do that, just clone it using native git and then import the project into eclipse using:
File -> Import -> Projects from Git -> Local
If your eclipse runs on Windows, you will need a linux machine (virtual machine will do) and clone the repo into a NTFS or Fat32 formatted storage. Then you will be able to copy the cloned repo into your git folder on the windows machine.