Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,390
Community Members
 
Community Events
184
Community Groups

Skip a file during creation of zip

I want to skip a file named .gitignore during creation of the zip i tried -x and --exclude command but it is not working here is my code .

pipelines:
  branches:
    main:
      - step:
          name: Copy code as ZIP file
          script:
            - apt-get update && apt-get install -y zip
            - git archive --format=zip HEAD -o code.zip -x .gitignore
          artifacts:
            - code.zip

I searched on forum but cannot find any solution  

1 answer

1 accepted

0 votes
Answer accepted
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 05, 2023

G'day @Robin 

Based on your YML parameter, you can't use -x on the git archive. Instead, try the following example to exclude .gitignore

pipelines:
  branches:
    main:
      - step:
          name: Copy code as ZIP file
          script:
            - apt-get update && apt-get install -y zip
            - git archive --format=zip HEAD -o code.zip ":(exclude).gitignore"
          artifacts:
            - code.zip 

Use ":(exclude).gitignore" to skip .gitignore when it's archiving.

I hope this helps.

Cheers,
Syahrul

+ git archive --format=zip HEAD -o code.zip ":(exclude).gitignore/"
fatal: There is nothing to exclude from by :(exclude) patterns.

Perhaps you forgot to add either ':/' or '.' ?

 

Not working for me this is from logs.

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 05, 2023

Hey @Robin 

Interesting, this works as expected on my end. As you can see on the screenshot below, it skipped the .gitignore when creating the zip file:

Screenshot 2023-04-06 at 3.21.18 PM.png

May I know what image are you using? I've read that older git may have issues using (exclude) parameters. I'm using the default image "

atlassian/default-image:3".
Could you try changing the image and see if that works?
Cheers,
Syahrul

Thank u so much after changing image it worked .

Like Syahrul likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events