Can .forceignore be used to not pull profiles that only exist in the scratch org?

I have an SFDX format project that contains some components but I do not want any profiles to be present.

When I do a:

sfdx force:source:status

to see what files would transferred by a sfdx force:source:pull, I get this result:

=== Source Status
STATE           FULL NAME                                         TYPE          PROJECT PATH
──────────────  ────────────────────────────────────────────────  ────────────  ────────────────────────────────────────────────────────────────
Remote Add      IntakeRelationship__c.Intake__c                   CustomField
Remote Add      IntakeRelationship__c.Contact__c                  CustomField
Remote Add      IntakeRelationship__c.Account__c                  CustomField
Remote Add      IntakeRelationship__c.Type__c                     CustomField
Remote Add      Admin                                             Profile
Remote Add      Custom: Sales Profile                             Profile
Remote Add      Custom: Marketing Profile                         Profile
Remote Add      Custom: Support Profile                           Profile
Remote Add      IntakeRelationship__c-Intake Relationship Layout  Layout
Remote Changed  Intake__c                                         CustomObject  sfdx-source/wiz/main/objects/Intake__c/Intake__c.object-meta.xml
Remote Add      IntakeRelationship__c                             CustomObject

I have tried various .forceignore values (such as **profiles and Profile/Admin) based on How to Exclude Source When Syncing or Converting and other Googling trying to exclude the profiles. But I am now thinking that the problem may be that there is not a “PROJECT PATH” for the profiles so there is nothing to match.

How can I stop the profiles from being pulled in this case?

(Pulling them and then deleting them is not an option because then the next push will try to delete them from the scratch org.)

Answer

I use this line in .forceignore for that:

force-app/main/default/profiles

The path should be relative to where your .forceignore lives

Attribution
Source : Link , Question Author : Keith C , Answer Author : Denis Pereverzev

Leave a Comment