Reputation: 418
In my github project, i have used the config below :
- name: FTP-Deploy-Action
uses: SamKirkland/[email protected]
with:
ftp-server: sftp://${{ secrets.HOST }}${{ secrets.PATH_PROJECT }}
ftp-username: ${{ secrets.FTP_USER }}
ftp-password: ${{ secrets.FTP_PASSWORD }}
git-ftp-args: --insecure
But on the step FTP-Deploy-Action
, i get this error :
fatal: Dirty repository: Having uncommitted changes. Exiting...
NB :
git status
make no sense (cause github actions clone the repo to a new env before git ftp push
, which produce the error)Github FTP-Deploy-Action issue link
For information, i have already read these link :
Upvotes: 4
Views: 2931
Reputation: 51
Note: I'm not posting this as a comment because I don't have the required reputation yet.
I was having the same issue. And as @fegnus, I encounter that after the npm install
step, the package-lock.json
file gets updated.
I solved the issue by replacing the npm install
command with npm ci
.
The npm ci
will do the following things:
node_modules
folder to ensure a clean state.package-lock.json
to install all the dependencies with the exact version.npm install
, npm ci
will never modify your package-lock.json
. It does however expect a package-lock.json
file in your project — if you do not have this file, npm ci
will not work and you have to use npm install
instead.Remember that the package-lock.json
is generated when we do npm install
on the development machine. And this file should be tracked by git.
References:
npm ci
documentation.Upvotes: 1
Reputation: 31
I was having the same problem, and discoved that after the npm install
step, the package-lock.json
file is updated, so the repository get dirty, you can check if it is your situation adding a git status
step before the ftp step:
- name: git status
run: git status -uno --porcelain
Im my case, if I reset the package-lock.json
file before the FTP step the problem is solved:
- name: reset package-lock.json
run: git checkout package-lock.json
Upvotes: 2
Reputation: 81
I got this problem too. It may be that your build process changes tracked files.
I added git reset --hard
before running FTP-Deploy-Actions. Following this tutorial's recommendations.
I'm very junior so there may be a better way I don't know of.
Upvotes: 3
Reputation: 79
I was having the same issue, as I was doing some appsetting transformation.
Then I found this and it worked for me.
- name: FTP-Deploy-Action
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.HOST }}${{ secrets.PATH_PROJECT }}
user: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
forceSsl: true
Deppending if your user has access to the root directory you also might want to change it to
- name: FTP-Deploy-Action
uses: sebastianpopp/ftp-action@releases/v2
with:
host: ${{ secrets.HOST }}
user: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
remoteDir: ${{ secrets.PATH_PROJECT }}
forceSsl: true
Note that instead of sftp:// I added a "forceSsl". I didn't needed it in my case.
Upvotes: 1