The assessmentee.com repository has so far been based on svn located on a webserver. About time to so something about that, moving it to Git and moving it to the cloud.
In Git bash check the git version
$ git --version git version 2.13.0.windows.1
git svn clone svn+ssh://assess@assessmentee/var/svn/assessmentee.com/trunk C:/xampp/htdocs/assessmentee.com
will create a new git repo.
The repository will be hosted at bitbucket.org.
public/private rsa key pair is created with
in the /c/Users/me/.ssh folder. The public key is stored in the bitbucket SSH key store.
The path of the private key is stored in the .ssh config file
Host bitbucket.org identityFile ~/.ssh/bitbucket/id_rsa
Mind the indentation in the second line
Then in the repo folder point git to the new remote url:
cd /c/xampp/htdocs/assessmentee.com git remote add origin ssh://email@example.com/rickit/assessmentee.com.git
Check the configuration:
$ git config --list firstname.lastname@example.org/rickit/assessmentee.com.git remote.rickit.fetch=+refs/heads/*:refs/remotes/rickit/* remote.rickit.puttykeyfile=C:\Users\me\.ssh\bitbucket\puttyprivatekey.ppk
If an initial commit is made at the remote repository and initial “git pull” is required. There may be a mismatch in the users in the original repo and the new one, therefore the command to use is
git pull --allow-unrelated-histories
Git bash sanity checks:
$ ssh -T email@example.com logged in as rickit. You can use git or hg to connect to Bitbucket. Shell access is disabled.
The disabled shell access line is a red herring
There is also the long -v (verbose) version:
ssh -Tv firstname.lastname@example.org OpenSSH_7.3p1, OpenSSL 1.0.2k 26 Jan 2017 debug1: Reading configuration data /c/Users/me/.ssh/config debug1: Offering RSA public key: /c/Users/me/.ssh/bitbucket/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 279 debug1: Authentication succeeded (publickey).
List the private keys:
ssh-add -l 2048 SHA256:iIv26JzZezl1IiVGBisChemklH8VijF8+2Ij0me3Fx2E /c/Users/me/.ssh/id_rsa (RSA)
Add a private key
$ ssh-add ~/.ssh/bitbucket/id_rsa Identity added: /c/Users/me/.ssh/bitbucket/id_rsa (/c/Users/me/.ssh/bitbucket/id_rsa)
Check if there is an ssh-agent:
ps -e | grep [s]sh-agent 15768 1 15768 15768 ? 197608 16:59:01 /usr/bin/ssh-agent
At this point there may be an error:
No supported authentication methods available (server sent: publickey)
Problem is that Git Bash depends on openSSH for SSH operations so define it explicitly
$ which ssh /usr/bin/ssh
And add to the .bashrc file the line
Having done all that, the repository can be pushed
git push origin master
Be aware that if you want to use TortoiseGit next you run into problems. This tool does not use openSSH for SSH operations but Putty / Pageant. Nothing wrong with that but Pageant does not understand private keys (the id_rsa) based on openSSH. Solution: open the private key in another tool called PuttyGen (import key) and save as a regular private key. Use this key in the TortoiseGit settings.
And what to do in the event of having two bitbucket accounts?
First add lines to the .ssh/config file:
Host bitbucket.org identityFile ~/.ssh/bitbucket/id_rsa Host bitbucket-2 Hostname bitbucket.org PreferredAuthentications publickey IdentityFile ~/.ssh/bitbucket-2/id_rsa
git push ssh://git@bitbucket-2/Dogiopatents/document-center.git