<p>You could use the git credentials.helper feature
<a href="https://git-scm.com/docs/gitcredentials" rel="nofollow noreferrer">https://git-scm.com/docs/gitcredentials</a></p>

CC BY-SA 4.0
2020-09-01T17:23:53.450Z
2020-09-01T17:23:53.450Z
user2821413
<p>We are using Jenkins Freestyle Project to push the changes on the remote server. We are executing shell script on remote host using ssh for it. To pull the changes on remote host, we are using origin url with git username and git password. The credentials should not be visible in plain text in the url that's why we have stored them in variables using 'secret text(s) or file(s)' option of 'Build Environment'.</p>
<p>At the Jenkin's end it is working as it is expected. The git credentials are not visible to the users who are using Jenkins for other projects but we are facing issue on the remote server where project was deployed. The remote server is showing git credentials in plain text. Any user with ssh access of the remote server is able to run the git reflog command in the project directory.</p>
<p>Port 22 cannot be opened on the server where gitlab is deployed so we cannot use ssh keys method to create the build in Jenkins. We can use only http method to pull the changes.</p>
<p>Is there any way so we could implement to avoid showing the git credentials in plain text in the project directory.</p>

CC BY-SA 4.0
2020-09-01T19:17:01.500Z
You can use any port that's free to carry out ssh traffic... it's not required to use port 22, that's just the default port for SSH. I think the answer here is to use SSH keys for auth.
unknownprotocol
<jenkins><git><credentials>
git reflog is showing plain text password used
Derek
# git reflog is showing plain text password used

(Asked by: username_0 on 2020-08-29)

We are using Jenkins Freestyle Project to push the changes on the remote server. We are executing shell script on remote host using ssh for it. To pull the changes on remote host, we are using origin url with git username and git password. The credentials should not be visible in plain text in the url that's why we have stored them in variables using 'secret text(s) or file(s)' option of 'Build Environment'.

At the Jenkin's end it is working as it is expected. The git credentials are not visible to the users who are using Jenkins for other projects but we are facing issue on the remote server where project was deployed. The remote server is showing git credentials in plain text. Any user with ssh access of the remote server is able to run the git reflog command in the project directory.

Port 22 cannot be opened on the server where gitlab is deployed so we cannot use ssh keys method to create the build in Jenkins. We can use only http method to pull the changes.

Is there any way so we could implement to avoid showing the git credentials in plain text in the project directory.

**Tags:** jenkins, git, credentials

> **Comments:**
> **username_1**: You can use any port that's free to carry out ssh traffic... it's not required to use port 22, that's just the default port for SSH. I think the answer here is to use SSH keys for auth.  

---

## 1 answers

### Answer by username_2 on 2020-09-01. Score: 1

You could use the git credentials.helper feature
<https://git-scm.com/docs/gitcredentials>


---

