Getting error curl: (23) Failed writing body (1364 != 1369)
Im running sudo sh gitlab.sh with error as below curl: (23) Failed writing body (1364 != 1369) ...sometime got curl: (23) Failed writing body (348 != 1369)
I add | tac | tac |
curl --header "Private-Token: $privateToken" "https://gitlab.com/api/v4/users/$userName/projects" | tac | tac
and no error but It just create backup folder but empty no files associates in the backup folder below.
gitlab-backup-2020-07-24-17-32-09
What could be wrong here. Thanks
Just tried it and it works, on macOS 10.15
If you tried it on linux, let me know the distribution and version and I'll try to reproduce it.
By the way, don't run it with 'sudo'
Hi..Im running on ubuntu as follows; Distributor ID: Ubuntu Description: Ubuntu 16.04.5 LTS Release: 16.04 Codename: xenial
I remove and re-clone and still getting the error below; **sh gitlab.sh mkdir: cannot create directory 'gitlab-backup-2020-07-25-17-50-57': Permission denied gitlab.sh: 5: cd: can't cd to gitlab-backup-2020-07-25-17-50-57 gitlab.sh: 12: gitlab.sh: jq: not found
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2732 0 2732 0 0 4687 0 --:--:-- --:--:-- --:--:-- 4694 curl: (23) Failed writing body (1364 != 1369) Done! All files downloaded here: /home/mylab/repo-backup** I noticed is I run the script without sudo No files downloaded in repo-backup and not able to create dir
if I run with sudo it will created dir and gitlab-backup-2020-07-25-17-55-43 but empty.... sudo sh gitlab.sh gitlab.sh: 12: gitlab.sh: jq: not found % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 2732 0 2732 0 0 4942 0 --:--:-- --:--:-- --:--:-- 4949 curl: (23) Failed writing body (1364 != 1369) Done! All files downloaded here: /home/mylab/repo-backup/gitlab-backup-2020-07-25-17-55-43
Please advise. thank you sir.
I install jq
./gitlab.sh mkdir: cannot create directory 'gitlab-backup-2020-07-25-18-02-30': Permission denied ./gitlab.sh: 5: cd: can't cd to gitlab-backup-2020-07-25-18-02-30 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10021 0 10021 0 0 17144 0 --:--:-- --:--:-- --:--:-- 17129 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to create the file MyPython_Test2.zip: Permission denied 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (23) Failed writing body (0 != 325) % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to create the file My: Permission denied 26 1160 26 313 0 0 486 0 0:00:02 --:--:-- 0:00:02 486 curl: (23) Failed writing body (0 != 313) curl: (6) Could not resolve host: Python_Test1.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0Warning: Failed to create the file My: Permission denied 31 985 31 312 0 0 549 0 0:00:01 --:--:-- 0:00:01 549 curl: (23) Failed writing body (0 != 312) curl: (6) Could not resolve host: Pipeline_Test1.zip Done! All files downloaded here: /home/mylab/repo-backup
Hi... I would like to update below I run as a root and run the script and able to do backup and create backup folder but the backup folder only have 1 project (1 zip file) out of 3 project that I have in my gitlab. From the message below I got error message curl could not resolve host, those are 2 project that are not in the backup folder created... curl: (6) Could not resolve host: Python_Test1.zip curl: (6) Could not resolve host: Pipeline_Test1.zip
May I know what could be the problem now...only this folder (MyPython_Test2.zip) created in the backup folder. Another 2 folder got error could not resolve host.
./gitlab.sh % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 10021 0 10021 0 0 17747 0 --:--:-- --:--:-- --:--:-- 17736 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 3351 0 3351 0 0 6152 0 --:--:-- --:--:-- --:--:-- 6159 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 1160 100 1160 0 0 2116 0 --:--:-- --:--:-- --:--:-- 2116 curl: (6) Could not resolve host: Python_Test1.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 985 100 985 0 0 1863 0 --:--:-- --:--:-- --:--:-- 1862 curl: (6) Could not resolve host: Pipeline_Test1.zip Done! All files downloaded here: /home/mylab/repo-backup/gitlab-backup-2020-07-26-12-12-49
why do you get the Permission denied error? There must be something wrong there...
have you tried running github.sh? does it work or you get the same error?
can you try to download a random public project from GitLab? Go here: https://gitlab.com/public and click on any project, then click on Download button -> you will see a popup menu with all the formats available -> right click on "zip" and Copy link location -> Open a terminal in the folder that's causing problems and run this command:
curl -o project.zip <paste-the-project-zip-url>
let me know if it works
Hi Alex,I test download zip file as suggested.
Public Project over public gitlab server I able to download the public project (project.zip) and able to unzip it without error curl -o project.zip https://gitlab.com/cinooo/numeric-overflow/-/archive/master/numeric-overflow-master.zip % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 17863 0 17863 0 0 37307 0 --:--:-- --:--:-- --:--:-- 37370
FYI, I also tried clone via https and able to get the repo no error. Just now problem to run it as normal user and problem 'could not resolve host' that make it only 1 project can be backup. (have 3 project, 2 got could not resolve issue)
Hi there! Smth went wrong with projectName.
Possible fix:
projectName=$(echo $projectName)
curl -H "Accept: application/vnd.github.nebula-preview+json" \
-H "Authorization: token $privateToken" \
"https://api.github.com/user/repos?visibility=all&affiliation=owner&per_page=200" \
| $"./../jq-win64.exe" -r '.[] | .name' \
| while IFS= read projectName; do
projectName=$(echo $projectName)
curl -H "Authorization: token $privateToken" -H "Accept: application/vnd.github.v3.raw" -L \
"https://api.github.com/repos/${userName}/${projectName}/zipball" --output $projectName.zip
done