Question: I have a table with duplicate data in one or two columns. I want to delete duplicate data and keep one record only. 

I tried the following code, but it deleted all of the data from my table.

```
DELETE from test del 
WHERE EXISTS (
        SELECT *
        FROM test ex
        WHERE ex.name= del.name      
        );

```

Answer: 
The solution is to use sshagent function in Jenkins Pipeline

```
sshagent(['SSH_JENKINS_CREDENTIALS_FOR_GIT']) {
    sh("git archive --format=tar --remote git@myserver.com:myrepo master |tar xf -")
}

```
There is no easy way to use a username and password for `ssh` in an automated script. OpenSSH only prompts for username and password on a TTY, which you won't have in an automated script unless you use something like `expect`. Moreover, even if you could do this, most Git servers will only accept an SSH key for authentication over SSH.

You haven't said what Git server you're using, so I can't provide more helpful details, but your choices are essentially to use an SSH key or to use the credentials you have to access the HTTPS API interface of your Git server to fetch an archive for you to use. For example, if you use GitHub or GitHub Enterprise, there is [an API URL to fetch tarballs](https://developer.github.com/v3/repos/contents/#get-archive-link).

Alternatively, you could try a shallow clone (e.g. `git clone --depth 1`). If you're hosting your own Git server instance, note though that shallow clones can be computationally intensive, so you may end up DoSing your instance if you use a large number of them.