S
S
Sergey Gordeenkov2018-12-20 18:51:53
git
Sergey Gordeenkov, 2018-12-20 18:51:53

How to copy a json file from a third-party repository to your own if it has been changed?

Good day to all.
There are 2 remote repositories (x1 and x2).
When changing the master in x1, you need to check if the errors.json file in the x2 repository has been updated.
If updated, then replace errors.json in the x2 repository and push it to the master.
I tried this
update_errors:
stage: build
script:
git archive --output=./errors_temp.json --remote=ssh://[email protected]:xxx/xxxx/xxxxxx.git HEAD errors. json
if diff errors_temp.json ./src/static/errors.json; then
echo "errors haven't been modified"
else
echo "errors has been modified, replacing ..."
git archive --output=./src/static/errors.json --remote=ssh://[email protected]:xxx/xxxx/xxxxxx.git HEAD errors.json
git rm ./errors_temp. json
git add .
git commit -m 'errors.json has been updated'
git push origin master
fi
only:
- master
But git archive adds pax_global_header to the resulting file. Is there any easier way to copy a file from a 3rd party remote repository without additional modification?
Thanks everyone for the advice.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question