Jump to content

How to Switch Gitsync to SSH Protocol


AaronKOG

Recommended Posts

I've been gitsyncing with the https+username+password or some time. Due to https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ I need to change this pretty soon to ssh. I see that SSH support was added late last year, but it isn't clear how to switch to using it.  I'm on plastic version 9.0.16.4421. I have my ssh setup properly to clone from my git repository (I have always used ssh protocol via cmd.exe for my github repos). When I attempt to switch to the ssh url in the UI I hit this:
image.png.ea716037b574a027bb82aab5cfa464b9.png
image.png.fe1b5475a701605ae56f80f9d6849418.png

Should I do as the prompt says and delete the mapping manually? Maybe I need to update the client/server? Don't want to do the wrong thing when it comes to anything gitsync 😉

Thanks,

Aaron

Link to comment
Share on other sites

Hi,

The problem is once you have defined a git repo to sync (eg: via https) you cannot change it. The mappings are generated for a specific repo.

One thing we could try is manually changing the destination repo in the

C:\Users\xxx\AppData\Local\plastic4\sync\git\35183a39-9975-46c2-9437-b510311e03ad\git.repository.conf

Anyway, we need to be careful when manually editing the configuration files because it's not supposed to be manually changed.

Probably the easiest solution is creating a clean new repo and syncing it with git from scratch using ssh.

Regards,

Carlos.

Link to comment
Share on other sites

  • 1 year later...

Hi,

Regarding Gitsync with ssh support, please check our detailed release notes. Please try via command line instead of GUI:

[Release notes]
GitSync: Added support to sync with Git repositories

 using SSH protocol. **Important note**: To use this
 feature you must have an SSH command line client
 (openssh or a clone) in your PATH environment variable
 and properly configured. Check "SSH client
 configuration" note for more info.

 

SSH CLIENT CONFIGURATION

  • You should have the command line SSH client "ssh" in
  your PATH environment variable.

 

  • Copy your private key (usually a file called "id_rsa")
  to your ssh config dir. It should be the ".ssh"
  dir under your user home directory.
    • If you are under windows, you need to set the
   environment variable "HOME", with the path to your
   user directory (e.g., C:/Users/myuser).

 

    • If you are under linux, do not forget to set proper
   permissions to the private key:
        $ chmod 600 /home/myuser/.ssh/id_rsa

 

  • Use the Gitsync in the same way as you normally do
  with http protocol (using plastic GUI or CLI), but
  specifying the SSH clone URL. e.g.:
        $ cm sync rep2 git git@bitbucket.org:myuser/myrepo.git

 

    • If the private key is protected by a passphrase, you
   will be requested to write it.

 

TROUBLESHOOTING

  • Problem: The ssh server is not in port 22, or I need
  to use different private keys for different servers.

 

    • Solution: You can create a "config" files under your
   ".ssh" directory specifying different settings for
   differents server. This is an example of ssh "config"
   file:


Host gitolite.elegosoft.com
User gitolite
Port 2222
IdentityFile ~/.ssh/id_rsa
Host github.com
User git
IdentityFile ~/.ssh/github_key
Host bitbucket.org
IdentityFile ~/.ssh/id_rsa

  • Problem: I get "An error occurred while connecting to Git".
    • Solution: It might be an error in the configuration of
   the ssh client. You can try gitsync using the command
   line in the following way to get more info:
        $ cm sync rep2 git git@bitbucket.org:myuser/myrepo.git


[/Release notes]


Best regards,
Carlos.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...