angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

"ng github-pages:deploy" is fail on 1.0.0-beta.22-1

Open ovrmrw opened this issue 9 years ago • 4 comments

Error message.

Command failed: git clean -f -d
warning: failed to remove src/lib

There was a permissions error during git file operations, please close any open project files/folders and try again.
You might also need to return to the master branch manually.

My Environment.

$ ng --version
angular-cli: 1.0.0-beta.22-1
node: 6.7.0
os: win32 x64

My Solution (from)

// node_modules/angular-cli/commands/github-pages-deploy.js

        function cleanGhPagesBranch() {
            return execPromise('git ls-files')
                .then(function (stdout) {
                var files = '';
                stdout.split(/\n/).forEach(function (f) {
                    // skip .gitignore & 404.html
                    if ((f != '') && (f != '.gitignore') && (f != '404.html')) {
                        files = files.concat("\"" + f + "\" ");
                    }
                });
                return execPromise("git rm -r " + files);
            });
        }

(to)

        function cleanGhPagesBranch() {
            return execPromise('git ls-files')
                .then(function (stdout) {
                var files = '';
                stdout.split(/\n/).forEach(function (f) {
                    // skip .gitignore & 404.html
                    if ((f != '') && (f != '.gitignore') && (f != '404.html')) {
                        files = files.concat("\"" + f + "\" ");
                    }
                });
                // return execPromise("git rm -r " + files);
                if (files) {
                    return execPromise("git rm -r " + files);
                } else {
                    return execPromise('git ls-files'); // do something
                }
            });
        }

It works.

ovrmrw avatar Dec 10 '16 14:12 ovrmrw

Fix above worked at my end

Thanks @ovrmrw !!

Using Debian Jessie and Node 6.9

armsc avatar Dec 19 '16 14:12 armsc

I'm responsible for this and am truly sorry. I wish it hadn't been included in 1.0.0-beta.22-1.

It has been fixed as of 1.0.0-beta.23 with the following:

return execPromise(`git rm -r ${files}`)
  .catch(() => {
    // Ignoring errors when trying to erase files.
  });

The issue is simply that git rm -r errors if it's not provided any files. This only happens upon initial deployment as there are no old files yet to remove.

rolyatsats avatar Dec 19 '16 17:12 rolyatsats

Closed via https://github.com/angular/angular-cli/pull/4385.

filipesilva avatar Feb 03 '17 14:02 filipesilva

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.