I have installed GitLab. Suppose I installed it in /home/myuser/gitlab.
I created a new project
I was told to create a repo "test" I put in /home/myuser/gitlab/test
I added some SSH key in /home/myuser/.ssh
Then I initialized a Git repo in /home/myuser/gitlab/test.
Following instructions, I added a remote git#localhost:root/testing.git
but when I try to push, I get this error message:
$ git push -u origin master
ssh: connect to host localhost port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I installed GitLab in OS X and I have other SSH keys in /home/myhome/.ssh, I have set up the user email and name inside /home/myuser/gitlab/.git/config, (and set those globally just for testing) and the server is launched from /home/myuser/gitlab. Does anybody have an idea where this error comes from?
If I run ssh git#localhost, I get
/home/myhome/.ssh/config line 4: garbage at end of line; "home".
where in this file I have some settings for a remote server for another project. I think it is the problem but I don't really know how to fix it.
Update : Here's the content of my ~/.git/config file
Host remote_test_server
Hostname remote_test_user#ftp.remote_test_server
IdentityFile ~/.ssh/id_rsa_stf.pub
User <your home acct>
/home/myhome/.ssh/config line 4: garbage at end of line; "home".
That would prevent any ssh command to properly function, because of a parasite echo done by the remote session.
Check your .profile or other .rc files, and see if any echo is done in those.
Or at least, test with ssh -T git#localhost, in order to disable any TTY allocation.
check also the content of your .ssh/config file, which doesn't seem to be properly formatted.
See this example of a config file:
User should be the login name of the account used for the ssh session on the rmeote server.
It should not be the homedir path.
IdentityFile should reference the private key (~/.ssh/id_rsa_stf), not the public one!
Hostname should reference the remote server 'ftp.remote_test_server', not the user#remoteServer.
Related
Here are my jenkins config:
Error message:
/var/jenkins_home/.ssh/known_hosts [SSH] No Known Hosts file was found at /var/jenkins_home/.ssh/known_hosts. Please ensure one is created at this path and that Jenkins can read it.
No matter how much I tried it doesn't work. I've read this post, but still no solution.
I got the same error while launching slave.It has to do with the SSH Slave Plugin. What worked for me was changing the Host key verification strategy in LAUNCH METHOD from "Known Hosts file verification strategy" to "Manually trusted key verification strategy".
CONFIGURE AGENT -> LAUNCH METHOD -> Manually trusted key verification
strategy - > SAVE.
Hope this helps.
The problem is that Jenkins causes confusion by reporting that the file is missing under /var/jenkins_home/, which is a hard-coded value. Instead, it should be telling you that the file is missing under your actual $JENKINS_HOME path. That way, you would immediately know where to look.
So the easiest way to fix this is to:
Go to the actual $JENKINS_HOME directory on your Jenkins master, and create a .ssh directory and known_hosts file under it, for example:
$ mkdir $JENKINS_HOME/.ssh
$ touch $JENKINS_HOME/.ssh/known_hosts
If you've ever SSH-ed from Jenkins master to your slave machine before, then you should already have a known_hosts file under your ~/.ssh directory. If you don't, then SSH from Jenkins master to Jenkins slave machine and it will get automatically created for you under ~/.ssh directory for that user.
Now open that ~/.ssh/known_hosts file and simply copy>paste the line that contains your slave machine's IP address to the $JENKINS_HOME/.ssh/known_hosts file. Alternative way is to copy the entire ~/.ssh/known_hosts file to $JENKINS_HOME/.ssh directory if that is easier for you.
A very simple step helped me to recover this error.
In Slave configuration, select "No verifying verification strategy" for Host Key Verification Strategy. This will allow master to connect with slave and host will also be remembered.
Next time on selecting "Known host file verification strategy" will not give this error.
when I am trying to clone a rails app repo I have got permission to, I am getting this issue.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Even after adding public key by generating one, I am unable to solve this.
Although I am able to clone using he https method but after making changes, the same error comes while I try to push the code.
Please suggest an answer for this.
First, cd into your .ssh directory. Open up the terminal and run:
cd ~/.ssh && ssh-keygen
Second, you need to copy this to your clipboard:
cat id_rsa.pub | pbcopy # On OSX
cat id_rsa.pub | xclip # On Linux
Third, add your newly generated ssh key to your account via the github/bitbucket website (just paste there).
Next, setup your git config:
git config --global user.name 'your_user_name'
git config --global user.email 'your_email'
Finally, restart your command line to make sure the config is reloaded.
Now, you should be able to clone and push from/to your github repository.
For more information on this, see this github page or this bitbucket page.
When attempting to clone, push, or pull over SSH with Git, you may receive one of these messages if Bitbucket couldn't authenticate with the keys that your SSH agent offered.
Here are the most common reasons why you may see these messages:
You used sudo when attempting the connection
You shouldn't use sudo when cloning, pushing, or pulling because the ssh-agent runs on the user level, not the root level.
Your public key isn't loaded into Bitbucket
To check if your public key is loaded into Bitbucket, do the following:
From Bitbucket, choose Personal settings from your avatar in the lower left.
The Account settings page displays.
Click SSH keys.
The SSH keys page shows a list of any existing keys.
If you don't have any keys listed, you can follow our Set up an SSH key documentation to set one up.
Your key isn't loaded into your SSH agent
If your SSH agent doesn't know to offer Bitbucket a key, the connection fails. You may run into this issue if you've recently restarted your system.
You can refer to this Article for more informations:
https://support.atlassian.com/bitbucket-cloud/docs/troubleshoot-ssh-issues/
Check few things.
Is the generated new key is the one your ssh agent using when trying to ssh to server.
(Your ssh agent might be using a different key than the one you generated)
use this to list currently loaded keys by agent.
ssh-add -L
You properly added public key to your repository hosting location.
The keys corresponding to above 1 and 2 should match.
Please see this article: GitHub: Generating SSH Keys. What happens when you run:
ssh -T git#bitbucket.org
?
You may have added the wrong key to authenticate with.
I faced this error when I created another repository in my local. My ssh-keys were already set up and I was trying to push code through vs code.
The issue got resolved when I git push-ed through git bash like I was doing before.
For bit bucket I think I have tried everything with ssh. I have tried the answer from this stackoverflow question as well. But it doesn't work. So finally I just changed the clone command from SSH to HTTPS and it worked. Only then it asked for password for my account.
Follow the instructions here: http://nerdwin15.com/2013/04/continuous-integration-with-stash-and-jenkins/
I Have jenkins and stash "connected" however, running the builds hangs at
Fetching upstream changes from
ssh://git#git.xyz.com:7999/gp/gp-xyz.git
FATAL: Failed to fetch from ssh://git#git.xyz.com:7999/gp/gp-xyz.git
hudson.plugins.git.GitException: Failed to fetch from
ssh://git#git.xyz.com:7999/gp/gp-xyz.git
So from what I gather the problem is that if i run this command on jenkins (which is running on windows)..
$ git clone ssh://git#git.xyz.com:7999/gp/gp-xyz.git Cloning into
'gp-xyz'... Enter passphrase for key '/c/Documents and
Settings/userMe/.ssh/id_rsa':
Is the fact that I have to enter a password here. How can i configure windows to store the ssh key so that I can clone like the build server does?
What i tried is:
userMe#jenkins /C $ ssh -T git#git.xyz.com:7999 ssh:
git.xyz.com:7999: no address associated with name
userMe#jenkins /C $ ssh -T git#git.xyz.com git#git.xyz.com's
password: Permission denied, please try again. git#git.xyz.com's
password:
However, This confuses me. Because Stash is running on port 7999 and there is no actual user named git on stash but it wont let me change that?
Use open ssh to setup private and public keys on your windows host
You can use a service like open SSH to generate a DSA/RSA-2 key and setup a no_pw option. (Do not setup an RSA-1 key) as stash has issues with RSA-1.
After that , add your public key into your list of keys in your stash user profile.
Regarding your other questions,
By default, Stash http protocol runs on port 7990 and the ssh protocol is supported on protocol 7999.
git is a default userid used by Stash behind the scenes to talk to the underlying git repository
I have production_server and git_repo_server,
git_repo_server .ssh/authorized keys have production user id_rsa.pub.
When I ssh to production_server and make git clone - it works fine, don't ask any password.
When I try to clone git repo to production_server on my local mashine using ssh I see:
Permission denied, please try again.
Permission denied (publickey,password).
It looks like ssh should be configured to send commands to remote server. But I don't know how to do it. Thanks for any help!
Problem was fixed. I added
Host *
ForwardAgent yes
to /etc/ssh/ssh_config
See ssh-agent tutorial
I had this issue the probelm was that the user/machine from which I'm accessing Gitosis was not registered as a user in the Gitosis project, and thus access was denied.
If you don't have one, generate SSH key in your machine "~/.ssh$ ssh-keygen -t rsa".
Use scp command to copy your public key (id_ras.pub) to gitosis_server, to gitosis_admin/keydir.
Make sure you rename id_rsa.pub to USER#SYSTEM.pub, USER = the client user, SYSTEM= the client system name.
Follow instructions here to add the user (USER#SYSTEM) to the project [https://help.ubuntu.com/community/Git#Adding_users]
I have been trying to set up a staging machine to run project at home (rails application).
# Remote machine connection
REPLOGIN=joel
REPADDRESS=192.168.2.100
REPLOCATION=/Users/joel/Projects/bio_watts #Repo location
REPNAME=biowatts
# Copy the repo to the server
echo "Copying the git repo to the server $REPADDRESS"
echo "repname:$REPNAME"
TEMPREP="$REPNAME.git"
echo "$TEMPREP"
git clone --bare .git $TEMPREP
scp -r $TEMPREP $REPLOGIN#$REPADDRESS:$REPLOCATION/
# Set up the origin for the project
#echo "Linking current repository to remote repository"
git remote add imac $REPLOGIN#$REPADDRESS:$REPLOCATION/$REPNAME.git/
All this worked fine
$git remote
imac <== this is my remote machine
When I try to git push to this machine I get:
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly
I know there is something about SSH ... but I don't understand what I need to do on my local and on my remote machines (Mac OS X Lion).
Can someone help?
Cheers,
Joel
NEXT QUESTION:
On my remote machine I do find my cloned biowatts.git file ... but I don't see the project files (rails app) ... how does it work?
My intent is to git push to my imac and run my app there (thin start) ???
Do I need to copy my file manually? I assumed that the git clone would copy every I needed ...
Your remote git server should know your machine via your iMac's public ssh key and should have a config somewhere allowing you to push (write rights).
That remote machine needs to know about your ssh keys.
You need to generate a key locally (if you don't have one) and then add the public key to the remote server's ~/.ssh/authorized_keys
You can follow the GitHub tutorial on setting up keys (if you don't already have them set up).
http://help.github.com/mac-set-up-git/
Instead of Step 4. Add your SSH key to GitHub, you'll need to add your key to the authorized_keys file on the server.
In the future, for those of you encountering this in assembla specifically, the solution is to copy your ~/.ssh/id_rsa.pub to the assembla profile. This post gives step by step instructions.