SVN+SSH and Sourceforge - windows

I'm new to both Sourceforge and SVN (SilkSVN on Windows).
I managed to check out a project using
svn co --username=zeroth123 svn://zeroth123#svn.code.sf.net/p/stddecimal/code/trunk stddecimal-code
However, every time I try and use ssh (so I can check in for example) it fails with
> svn co --username=zeroth123 svn+ssh://zeroth123#svn.code.sf.net/p/stddecimal/code/trunk stddecimal-code
svn: E720087: Unable to connect to a repository at URL 'svn+ssh://zeroth123#svn.code.sf.net/p/stddecimal/code/trunk'
svn: E720087: Can't create tunnel: The parameter is incorrect.
I've set SVN_SSH to point to my fully qualified plink.exe and it makes no difference. I also tried changing it to junk.exe and didn't get anything different, so I don't think we're even looking at SVN_SSH, which exhausts all of the advice I've been able to find on the Sourceforge and other forums.
For the record I am the project administrator and therefore have write permissions (or at least think I do!)
Any ideas?

`%SVN_SSH% needs to be set correctly and an SSH key needs to be registered with Sourceforge.
Note that new Sourceforge projects are version 2.0 by default, while 99% of the Sourceforge documentation is for version 1.0 and appears outdated.
These instructions assume you have SVN and the PuTTY tools installed, and that you can successfully access your project using a non-secure protocol, eg the read-only svn checkout svn://USER#svn.code.sf.net/p/PROJECT/code/trunk PROJECT-code style command should work.
These instructions explain how to do the same with svn checkout svn+ssh://... which is needed for write access to Sourceforge.
Set %SVN_SSH% to the fully qualified path of your SSH client. E.g. setx SVN_SSH "C:/Program Files (x86)/PuTTY/plink.exe"
svn expects forward slashes or double back-slashes in the path
You may have to reopen a cmd window
Test by typing %SVN_SSH% at the prompt and confirm you get your ssh programs help screen (or whatever behaviour you expect from executing with no arguments)
(Optional?) Cache the server RSA key. Open PuTTY, login to svn.code.sf.net (or whatever the server of your project is). A prompt will appear asking if you if you want to cache the server RSA key - click Yes.
You might not need to do this, if not when you use SVN to connect ot your project for the first time you will be asked the same question. Type y.
However, I did this because I thought the interactive prompt could be part of the problem.
Create a public / private key and register the public key with Sourceforge.
On creating a key, more info herefor example.
If you use PuTTY, use PuTTYgen to create the key, and make sure the private key is loaded in pageant. Ironically Launchpad has excellent instructions.
The public key can be registered on Sourceforge by navigating to Home > Account > Services and clicking Edit SSH Keys for Shell/CVS.
Now a checkout using svn+ssh protocol should work!

I followed the instructions here and it worked. Its a quicker method that doesn't require uploading keys etc.
Download plink.exe from http://the.earth.li/~sgtatham/putty/latest/x86/plink.exe
Place the plink.exe in your windows installation directory (%windir%)
Open the following file using Notepad %APPDATA%\Subversion\config
Add or Replace the following line in the [tunnels] section (replace login and pwd with your sourceforge login and password)
ssh = c:\\windows\\plink.exe -batch -l <LOGIN> -pw <PWD>
(note the double backslash)
Save and close the file

For me the issue was that Tortoise was initially installed on the D drive. I uninstalled it and reinstalled it on C without changing the related settings. The solution was to copy the TortoiseSVN folder from C drive to its original location in D drive.

For anybody (like me) working with Tortoise SVN who has it working for Tortoise SVN but needs command line access for easier bulk analysis... and doesn't want to go through the faff of registering an SSH key.
Copy the value you are using in Tortoise - Settings - Network - SSH Client (mine has username, password arguments)
Edit the command line configs ssh line in %APPDATA%\Subversion\config as per the answer above to use the line you copied from Tortoise
That way, you can use the Tortoise Plink.exe with arguments for username and password.

Related

Problems using GIT w/ SSH key file under Windows

I've problems using GIT with the shell, Visual Studio Code and Visual Studio 2015 (community edition).
Earlier this year I started using GIT with eGit (under Eclipse of course) without any problems. I installed GIT on my server, created a ssh key pair and after a few tests it worked (and still works).
However, now I want to use that GIT on my server with Visual Studio Code and maybe later with Visual Studio 2015.
I got stuck on this issue: GIT trys to use my PPK and asks me for the passphrase (which is emtpy). If I enter a wrong phrase it asks again and continues only if I answer correct (simply enter key). So I think everything is OK till here. But then it asks for the user password for the git-user (the right one btw) on the server and fails. Why?
In the log of my server I can't see any entry about logging in using the key file, only the errors about trying to log in with the password (which is disabled).
If I use putty with that key file I'm able to connect to my GIT server and I also get an entry in the log file. So I'm sure that everything is OK with the server.
What am I missing? I would appreciate any help about that!
Using it with Visual Studio 2015 (I can't solve the issue that it doesn't find libssh when I try to recompile the GIT module following the well known blog entry from Bernardo Pastorelli) or saving the enter key press would be a bonus, however, I would be happy if I could use GIT with key file under Shell / Visual Studio Code at all.
OS: Windows 7 64 bit
GIT 2.10.2.windows.1
VSC: V 1.7.2
TIA!
I'll try to answer the simpler question in your Post:
I would be happy if I could use GIT with key file under Shell
Once, that is done, you can build on it.
Git for windows uses Openssh and therefore will not be able to use the putty PPK file directly.
Two ways forward
Option 1: Convert PPK file to OpenSSH format
Steps to do so:
Open your private key in PuTTYGen
Top menu “Conversions”->”Export OpenSSH key”.
Save the new OpenSSH key when prompted.
To use this new openssh key for your git server, do the following:
Open up Git Bash shell and there edit ~/.ssh/config (create ~/.ssh/ if it does not exist) and define this host:
Host AuxBurgerGitServer
Hostname whatevers-your-git-remote-is
User the-git-user
IdentityFile ~/.ssh/the-open-ssh-key-exported-before
Test this by doing a ssh -T AuxBurgerGitServer which should not show any errors.
If you go this way, you should use the HOST defined above whenever referring to any repositories on this host. Therefore, for example, to clone a repo you would do something like:
git clone ssh://AuxBurgerGitServer/some-repo-name
Option 2: Configure your GIT to use pageant
You can load your PPK file in pageant and configure GIT to use pageant for authentication.
For this, the only thing you would need is to setup an environment variable like so using:
Control Panel → System → Advanced system settings → Environment variables
(or on Windows 10: Control Panel → Search → Environment variables)
GIT_SSH=c:\Program Files\Putty\plink.exe

IntelliJ IDEA git Permission denied (publickey)

I got a strange problem with using git on IntelliJ IDEA on Windows 10.
If I want to access the remote repo on GitLab, I always get
Permission denied (publickey).
Everything I found here or via Google didn't solve the problem.
I tried:
Setting the ssh executable to Native
Converting my public key from Putty to ssh-keygen style
Removing known_hosts
I also tried to access the repo with Git Bash, it works fine like that.
Another interesting fact is that after removing known_hosts, I got "Host key verification failed". I had to use Git Bash once to recreate the known_hosts entry, after that I got the Permission denied error again. Somehow I don't get asked for any user input.
I faced this problem while connecting bitbucket cloud from my Intellij 2019.2 , which thankfully got solved with the following steps. Please note that these steps are to be carried out after you successfully generate and add ssh-public key to your bitbucket/github/gitlab profile.
Open Git-SCM ssh_config file present in Git-SCM installation directory.It's default location in Windows (for 64 bit) is in C:\Program Files\Git\etc\ssh\
Add the following lines into ssh_config
Host *your-gitlab-or-github-or-bitbucket-hostname*
IdentityFile *your-ssh-rsa-privatekey-file-with-absolute-path*
for e.g
Host bitbucket.org
IdentityFile C:/Users/Sahil/.ssh/id_rsa
Source:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004124959-IntelliJ-2019-1-3-Can-t-access-git-using-SSH-keys
Update IDEA 2021.2.3
The bug in Sahil's answer has been fixed and Christian's solution is not needed with the correct entry in your ssh config file for the most common case of one key for one or more hosts. Additional options for complex configurations, such as multiple keys to the same or multiple hosts, can be found in Maddes comprehensive answer on superuser.
ANY inconsistency between ssh-agent and ssh-add leads to a situation where some things work and some don't.
For example, I had the Windows OpenSSH agent running but my path pointed first to the Git for Windows ssh-add. Many such failures are possible given the many ssh implementations out there, so know that you know where things are running from.
To get ssh working in IDEA...
Git for Windows
Install Git for Windows. I put it in C:\Git since, as a standard user without an elevated install, I couldn't write to C:\Program Files.
In Control Panel | User Accounts | Change my environment variables add the Git usr\bin folder to the path after the cmd folder entry already there (e.g. C:\Git\usr\bin for my installation).
Unset environment variable HOME -- it still breaks ssh in this version of IDEA.
In a Windows cmd.exe console, run start-ssh-agent.cmd to start the agent
In IDEA in Settings | SSH Configurations | Authentication type: set it to Key pair OpenSSH or PuTTY and test your connection. Then, make a small change and test Commit and push....
Windows OpenSSH
In Control Panel | User Accounts | Change my environment variables add C:\Windows\System32\OpenSSH to your path. Make sure no other ssh implementation is ahead of this in the path!
Start the OpenSSH agent in Task Manager | Services (or any number of other ways)
Set your IDEA SSH Configuration as #5 above
Keep in mind that, on Windows, ssh in IDEA uses the environment available in a standard Windows command-line console (cmd.exe). If git operations work there, then with the above steps in place, they'll work in IntelliJ.
It has been really long since OP but here is my solution on an execution basis:
You need to open a prompt and set the ENVVAR GIT_SSH_COMMAND.
You need to open IntelliJ from that same prompt.
Example:
> set GIT_SSH_COMMAND=ssh -i C:\\path\\to\\not\\default\\key
> idea
Also the path to not-default-key should use ~ instead of %userprofile% or paths unix-like using /.
I was having this same issue, and while it did have to do with the public key, my issue was concerned with WSL2/Linux and windows .ssh folders. My keys were in my WSL2/linux folder system, but intelliJ was looking in my windows folder system.
I copied my rsa keys from WSL2 to windows, and it worked automatically. In fact, I attempted to have it fail again by removing the keys from the Windows folders, but intelliJ must have it's own keylocker solution, because even without the keys in the Windows .ssh folder intelliJ continued to work.
For a screen capture explaining it you can see it here https://vimeo.com/558267383/74d55415c4
If you're using wsl2 in Clion like me, just add
Host github.com
IdentityFile /home/yieatn/.ssh/github
to /home/user/.ssh/config (create if it doesn't exit). You don't even have to restart IDE.
Adding to Cristian Torres's answer:
For all of you folks struggling with a similar problem on Mac OSX:
In IntelliJ, PyCharm, etc. click Tools -> Create Command-line Launcher...
Open your terminal and execute:
$ export GIT_SSH_COMMAND="ssh -i ~/.ssh/your-custom-private-key"
$ idea
For PyCharm the executable name is charm or /usr/local/bin/charm
Goland: goland or /usr/local/bin/goland
WebStorm: webstorm or /usr/local/bin/webstorm

Using and running Tortoise svnsync in Windows via command line

I have a local repository and I have just signed up to unfuddle and want to sync my local repository to the new one I have created on there.
I was told to run the following command:
svnsync init --username USERNAME http://username.unfuddle.com/svn/username-rep http://SOURCE_REPO_URL
Firstly, I assume I can remove the username stuff if the source repository doesn't require authentication?
Secondly, when I run that command my system doesn't recognize it. I assumed svnsync needed to be added somewhere in Windows so that it could be run via it's name only (think the correct term is an environment variable)?, but not only do I not know how to do that I don't know what program to add...... I cannot find any svnsync.exe or anything locate din my TortoiseSVN folder.
What do I need to do here?
When you install TortoiseSVN you are given the option to install the Subversion binaries as well:
Once you do that, you will see svnsync.exe in the installation folder:
As long as you have C:\Program Files\TortoiseSVN\bin in your PATH variable, you will be able to call svnsync.exe from the command-line:
(You can view your PATH variable thus (on Windows 7): Start -> right-click Computer -> Properties -> Advanced system settings -> Environment variables.... DO NOT overwrite whatever is there - simply append the path to TortoiseSVN if it isn't already there. More info here.)
Hope this helps.

Source Tree for Windows doesn't seem to work with valid SSH key

I have created an ssh key pair using putty within Source Tree on Windows, and then added that to my repo client (I use Gitlab on a personal server).
This works fine from gitbash (cloning and pushing etc) and via SourceTree for OSX but after adding the .ppk key to pageant, which is actively running and seems to have loaded the key correctly, I cannot seem to clone via SourceTree. I get a "This is not a valid source Path/URL" when adding the repo path with details stating:
fatal: Could not read from remote repository. Please make sure you
have the correct access rights and repository exists.
If I add an existing repo that I have cloned using the same ssh key pair via git bash (by just drag dropping the folder into Source Tree for Windows) that seems to work up to a point - I can commit and see history etc. When I try to Push, however, it fails with much the same message (I've altered the repo path):
git -c diff.mnemonicprefix=false -c core.quotepath=false push -v
--tags origin master:master Pushing to git#MyServer.com:MyRepo.git
fatal: Could not read from remote repository. Please make sure you
have the correct access rights and the repository exists.
Completed with errors, see above.
As far as I can tell Pageant is up and running with the correct (well only) ssh key on my machine.
Any help is very welcomed.
Ok so this is a little embarrasing/confusing.
It would seem that I did not copy the correct public key onto my repo management web interface. The thing is, I copied the public key from git bash using the command:
clip < ~/.ssh/id_rsa.pub
But that seems to give me a different public key from what I actually get opening id_rsa.pub in a text editor...
Is that normal? Why is it different? Why does it work within gitbash and not in SourceTree (via pageant).
Anyway, copying the contents of my public key in directly from the file when opened in notepad got things to work with SourceTree and Pageant etc.

Global Subversion SSH config in Windows / Checking out Subversion project as SYSTEM on Windows

I'm trying to set up a scheduled Subversion commit from Windows Server 2003 machine over SVN+SSH as a task. I'd like the commit script to be executed as SYSTEM-user. So I'm guessing, for that to work I need to check-out the repository as SYSTEM, too - but am unable to achieve it so far.
I'm already able to achieve the above with my own user over SSH. I've done the following:
I added a [tunnels] entity in my local subversion configuration:
ssh = plink.exe -i "C:/Keys/my_key.ppk"
Added the key to the authorized_keys file on the server running Subversion
I checked out the repository with a script as below:
svn co svn+ssh://user#server/path/to/repo/ C:\Local\Project\Path
I'd now like to reproduce the above steps for SYSTEM user, to be able to run a scheduled commit later. The problem I'm facing is I don't know how to check out the repository as SYSTEM, because:
I don't know the syntax to use to check out a repository as SYSTEM
I don't know where the global (or SYSTEM's) Subversion config is stored on a Windows Server 2003. I've already tried: C:\Documents and Settings\Default User\Application Data\Subversion and C:\Documents and Settings\Administrator\Application Data\Subversion, but without success.
I also read somewhere I possibly could use svn switch for what I want, but wouldn't know how to svn switch as SYSTEM. I also considered writing scripts for svn check-out or switch and running them as SYSTEM, but then I still need global SVN config to add my_key.ppk, too.
I hope the above description is clear enough. I've been struggling with it for a long time now and am having problems summarizing it myself. Any hints appreciated.
As a side, that doesn't seem to be totally off-topic: https://serverfault.com/q/9325/122307
This is not a real answer to your question, yet it might solve your problem: Why not use svn <command> --config-dir ARG or svn <command> --config-option ARG?
You could specify the config file/option like this, thus being able to set [tunnels].
#cxxl really answered on question, when mentioned --config-dir. I'll just try to shed some light on problem
I'm guessing, for that to work I need to check-out the repository as SYSTEM
Wrong and bad guessing, because stored locally user's auth data doesn't used in case of SSH-auth, for ssh remote authentication performed. Per-user auth-dir
\%AppData%\Subversion\auth>dir /W
...
[svn.simple] [svn.ssl.client-passphrase]
[svn.ssl.server] [svn.username]
...
contain stored credentials only for http|https|svn and cert-based client authentication, and nothing for ssh-related repositories
I.e your executed under LSA script must be able to
* read Working Copy files (checkouted under any other real local user), maybe write (can't recall requirement for .svn dir permissions)
* read and, thus, use predefined and fine-tuned Subversion's config files (tunnel section), which can be config of any other user
PS: swn switch change linked URL of repository for Working Copy and have nothing common with users

Resources