sync private repo, clone success, sync always error
Run on k8s. ref ssh.md
v3.1.2
wait=10
I sync a private repo on github. clone success, but sync always have error.
I0911 06:22:02.033890 1 main.go:269] "level"=0 "msg"="starting up" "args"=["/git-sync","-ssh","[email protected]:xxx/xxx","-branch=master","-depth=1","-wait=10","-max-sync-failures=100"]
I0911 06:22:14.301324 1 main.go:489] "level"=0 "msg"="cloned repo" "origin"="[email protected]:xxx/xxx"
I0911 06:22:14.305088 1 main.go:409] "level"=0 "msg"="syncing git" "hash"="2875e71b10e97409fb466e484d0406860909b8d0" "rev"="HEAD"
I0911 06:22:24.620860 1 main.go:433] "level"=0 "msg"="added worktree" "branch"="origin/master" "path"="/tmp/git/rev-2875e71b10e97409fb466e484d0406860909b8d0"
I0911 06:22:24.632092 1 main.go:453] "level"=0 "msg"="reset worktree to hash" "hash"="2875e71b10e97409fb466e484d0406860909b8d0" "path"="/tmp/git/rev-2875e71b10e97409fb466e484d0406860909b8d0"
E0911 06:24:17.901433 1 main.go:299] "msg"="unexpected error syncing repo, will retry" "error"="error running command: exit status 128: \"fatal: Could not read from remote repository.\\n\\nPlease make sure you have the correct access rights\\nand the repository exists.\\n\""
I0911 06:24:17.901549 1 main.go:300] "level"=0 "msg"="waiting before retrying" "waitTime"=10000000000
and I try to exec in the pod, rm the repo(rev-xxxx and dest). Watch the log clone success, sync also have error.
I0911 06:38:50.484497 1 main.go:476] "level"=0 "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/tmp/git"
I0911 06:38:59.023319 1 main.go:489] "level"=0 "msg"="cloned repo" "origin"="[email protected]:xxx/xxx"
I0911 06:38:59.034301 1 main.go:409] "level"=0 "msg"="syncing git" "hash"="2875e71b10e97409fb466e484d0406860909b8d0" "rev"="HEAD"
I0911 06:39:04.997677 1 main.go:433] "level"=0 "msg"="added worktree" "branch"="origin/master" "path"="/tmp/git/rev-2875e71b10e97409fb466e484d0406860909b8d0"
I0911 06:39:05.010356 1 main.go:453] "level"=0 "msg"="reset worktree to hash" "hash"="2875e71b10e97409fb466e484d0406860909b8d0" "path"="/tmp/git/rev-2875e71b10e97409fb466e484d0406860909b8d0"
E0911 06:39:15.060726 1 main.go:299] "msg"="unexpected error syncing repo, will retry" "error"="error running command: exit status 128: \"fatal: Could not read from remote repository.\\n\\nPlease make sure you have the correct access rights\\nand the repository exists.\\n\""
I0911 06:39:15.060839 1 main.go:300] "level"=0 "msg"="waiting before retrying" "waitTime"=10000000000
I don't know how to reproduce this. We have no real test for SSH (help wanted). If you run this with -v 5 it will log all the commands it ran - you could step through those to see if something sticks out?
I confirm, syncing from private repo (Gitlab) is stuck at:
I0110 16:06:49.775577 10 main.go:507] "level"=0 "msg"="updating submodules"
The data of the main repo is correctly cloned (as I can preview in the console)
We now have a test for SSH. I don't know how to reproduce this, so I am asking - either or both of:
- Provide really good logs (-v 5)
- Help write a test case that fails
On Fri, Jan 10, 2020 at 8:08 AM Grzegorz Brzezinka [email protected] wrote:
I confirm, syncing from private repo (Gitlab) is stuck at: I0110 16:06:49.775577 10 main.go:507] "level"=0 "msg"="updating submodules"
The data of the main repo is correctly cloned (as I can preview in the console)
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/git-sync/issues/182?email_source=notifications&email_token=ABKWAVAIG3KD7H4SCEOD2HTQ5CMPTA5CNFSM4IVQELA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIUMP6Q#issuecomment-573097978, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKWAVC4UIIMNBNROE7PQYTQ5CMPTANCNFSM4IVQELAQ .
Same here.
Steps to reproduce:
- Create a private Gitlab repo
- Create a personal token
- Set the a volume to mount on
/tmp - Set the configuration
GIT_SYNC_USERNAME=<gitlab username>
GIT_SYNC_PASSWORD=<gitlab personal token>
GIT_SYNC_WAIT=60
GIT_SYNC_DEST=content
GIT_SYNC_MAX_SYNC_FAILURES=-1
First time, when the container is created and the volume is empty, it works propperly.
INFO: detected pid 1, running init handler
I0306 09:34:17.095608 13 main.go:322] "level"=0 "msg"="starting up" "args"=["/git-sync"]
I0306 09:34:17.096026 13 main.go:575] "level"=0 "msg"="cloning repo" "origin"="https://gitlab.com/<my-repo-goes-here-in-real-logs>" "path"="/tmp/git"
I0306 09:34:18.838511 13 main.go:481] "level"=0 "msg"="syncing git" "hash"="35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "rev"="HEAD"
I0306 09:34:20.009112 13 main.go:502] "level"=0 "msg"="adding worktree" "branch"="origin/master" "path"="/tmp/git/rev-35ee736cb51ce438792912e8bbf72bb4d6f19ecd"
I0306 09:34:20.018799 13 main.go:525] "level"=0 "msg"="reset worktree to hash" "hash"="35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "path"="/tmp/git/rev-35ee736cb51ce438792912e8bbf72bb4d6f19ecd"
I0306 09:34:20.018949 13 main.go:529] "level"=0 "msg"="updating submodules"
But after the first sync it fails all the followng tryouts.
I0306 09:38:29.754810 13 main.go:354] "level"=0 "msg"="waiting before retrying" "waitTime"=60000000000
I0306 09:39:30.859226 13 main.go:677] "level"=0 "msg"="update required" "local"="35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "remote"="warning: redirecting to https://gitlab.com/<my-repo-goes-here-in-real-logs>.git/\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "rev"="HEAD"
I0306 09:39:30.859379 13 main.go:481] "level"=0 "msg"="syncing git" "hash"="warning: redirecting to https://gitlab.com/<my-repo-goes-here-in-real-logs>.git/\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "rev"="HEAD"
E0306 09:39:31.904736 13 main.go:353] "msg"="unexpected error syncing repo, will retry" "error"="error running command: exit status 128: \"error: cannot lock ref 'worktrees/\\\\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd\\\"/HEAD': unable to resolve reference 'worktrees/\\\\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd\\\"/HEAD': Invalid argument\\nfatal: failed to run reflog\\n\""
I0306 09:39:31.904836 13 main.go:354] "level"=0 "msg"="waiting before retrying" "waitTime"=60000000000
"hash"="warning: redirecting to https://gitlab.com/
I have never seen that warning before, and it is messing up the command parsing. This runs "git ls-remote -q origin ". Is there any flag that you can issue to elide that warning? Or can you confirm that is stderr vs stdout? We use CombinedOutput today, which we could split out, at the cost of some plumbing, but before I do that, would it matter?
On Fri, Mar 6, 2020 at 2:04 AM Daniel Iñigo [email protected] wrote:
Same here.
Steps to reproduce:
- Create a private Gitlab repo
- Create a personal token
- Set the configuration
GIT_SYNC_USERNAME=
GIT_SYNC_PASSWORD= GIT_SYNC_WAIT=60 GIT_SYNC_DEST=content GIT_SYNC_MAX_SYNC_FAILURES=-1 Volume mounted on /tmp First time, when the container is created and the volume is empty, it works propperly. But after the first sync it fails all the followng tryouts.
I0306 09:38:29.754810 13 main.go:354] "level"=0 "msg"="waiting before retrying" "waitTime"=60000000000 I0306 09:39:30.859226 13 main.go:677] "level"=0 "msg"="update required" "local"="35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "remote"="warning: redirecting to https://gitlab.com/
.git/\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "rev"="HEAD" I0306 09:39:30.859379 13 main.go:481] "level"=0 "msg"="syncing git" "hash"="warning: redirecting to https://gitlab.com/ .git/\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd" "rev"="HEAD" E0306 09:39:31.904736 13 main.go:353] "msg"="unexpected error syncing repo, will retry" "error"="error running command: exit status 128: "error: cannot lock ref 'worktrees/\\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd\"/HEAD': unable to resolve reference 'worktrees/\\n35ee736cb51ce438792912e8bbf72bb4d6f19ecd\"/HEAD': Invalid argument\nfatal: failed to run reflog\n"" I0306 09:39:31.904836 13 main.go:354] "level"=0 "msg"="waiting before retrying" "waitTime"=60000000000 — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/git-sync/issues/182?email_source=notifications&email_token=ABKWAVDNJFCBZAGN2SRSVY3RGDDDTA5CNFSM4IVQELA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOAZP6A#issuecomment-595695608, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKWAVCNHKBPC6M7A6AUW6LRGDDDTANCNFSM4IVQELAQ .
From a first glance I think this might be due to the provided URL either not ending with .git or being a legacy one from a Gitlab project.
First suggestion would be to use https://gitlab.com/<my-repo-goes-here-in-real-logs>.git as repository URL.
Well, yes, buy I'd like to solve this properly
On Sat, Mar 7, 2020, 12:49 PM Michael Grosser [email protected] wrote:
From a first glance I think this might be due to the provided URL either not ending with .git or being a legacy one from a Gitlab project.
First suggestion would be to use https://gitlab.com/
.git as repository URL. — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/git-sync/issues/182?email_source=notifications&email_token=ABKWAVDOXDZ4D7NB4WDOWEDRGKXPNA5CNFSM4IVQELA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOEFCJY#issuecomment-596136231, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKWAVAYSAO64SX7EP3BZC3RGKXPNANCNFSM4IVQELAQ .
@stp-ip you where right. Do you think checking if repo matches/^(http|git).*\.git/, or mentioning that the URL should point to the repo instead of the repo page, but the repo itself with the .git extension) is worth mentioning in the README?
This made my day. Thanks. Tell me if I can provide further logs.
Before you disappear, can you confirm for me that the "redirecting" message comes on stderr, rather than stdout?
On Mon, Mar 9, 2020 at 3:37 AM Daniel Iñigo [email protected] wrote:
@stp-ip https://github.com/stp-ip you where right. Do you think checking if repo matches/^(http|git).*.git/, or mentioning that the URL should point to the repo instead of the repo page, but the repo itself with the .git extension) is worth mentioning in the README?
This made my day. Thanks. Tell me if I can provide further logs.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/git-sync/issues/182?email_source=notifications&email_token=ABKWAVCH7AOU3UQCFZ56SYDRGTBFRA5CNFSM4IVQELA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOGR3QY#issuecomment-596450755, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKWAVASJ5F5CJRFAPMX37TRGTBFRANCNFSM4IVQELAQ .
I have a PR to split stdout and stderr, if I can confirm this is it. Would be nice to have a test that reproduced it...
On Mon, Mar 9, 2020 at 2:48 PM Tim Hockin [email protected] wrote:
Before you disappear, can you confirm for me that the "redirecting" message comes on stderr, rather than stdout?
On Mon, Mar 9, 2020 at 3:37 AM Daniel Iñigo [email protected] wrote:
@stp-ip https://github.com/stp-ip you where right. Do you think checking if repo matches/^(http|git).*.git/, or mentioning that the URL should point to the repo instead of the repo page, but the repo itself with the .git extension) is worth mentioning in the README?
This made my day. Thanks. Tell me if I can provide further logs.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kubernetes/git-sync/issues/182?email_source=notifications&email_token=ABKWAVCH7AOU3UQCFZ56SYDRGTBFRA5CNFSM4IVQELA2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOGR3QY#issuecomment-596450755, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKWAVASJ5F5CJRFAPMX37TRGTBFRANCNFSM4IVQELAQ .
sorry @thockin , you where right. The moment I got it fixed I lost focus on this. Can you explain how to ensure if the output goes to stderr? for example with a docker command that only outputs stderr? this way I can run it with my current config and tell you
docker run -it --rm --env-file .env \
myregistry.com/git-sync \
"<here the command that signals if stderr>"
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten
Hi - I think I'm experiencing this issue. I have a Gitlab repository which is an umbrella for a bunch of submodules, and gitsync successfully performs the full recursive submodule sync (though it is pretty slow) but then fails once the sync is complete.
It doesn't create the 'sync' symlink, and then the pod crashes and restarts, resulting in this error message:
I0521 13:42:42.380969 11 main.go:700] "level"=0 "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/git"
Any ideas?
Any updates on this one? Cloning a private repo works, but syncing seems to error out frequently. In a very uncommon case the pods run normally.
"msg"="too many failures, aborting" "error"="Run(git ls-remote -q origin refs/heads/master): exit status 128:
{ stdout: \"\", stderr: \"fatal: Could not read from remote repository.\\n
\\nPlease make sure you have the correct access rights\\nand the repository exists.\\n\" }" "failCount"=0
Using apache airflow helm chart dags sync with a self hosted gitlab on a custom port so my git url is something like
ssh://[email protected]:2222/group/project.git
Any solution for this issue ? We are also facing the same issue. Following is the error message.
INFO: detected pid 1, running init handler
6/25/2021 8:01:10 AM I0625 12:01:10.405525 11 main.go:507] "level"=0 "msg"="starting up" "pid"=11 "args"=["/git-sync"]
6/25/2021 8:01:10 AM I0625 12:01:10.405643 11 main.go:860] "level"=0 "msg"="cloning repo" "origin"="[email protected]:xxxx/xxxx.git" "path"="/opt/airflow/dags"
6/25/2021 8:01:10 AM I0625 12:01:10.410489 11 main.go:866] "level"=0 "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/opt/airflow/dags"
6/25/2021 8:01:10 AM E0625 12:01:10.430887 11 main.go:172] "msg"="too many failures, aborting" "error"="unlinkat /opt/airflow/dags/.git/objects/pack/.nfs8811e9592a768dc80000003a: device or resource busy" "failCount"=0
Regards, Chandra.
@althati "device or resource busy" seems to have nothing to do with git-sync itself. Your filesystem is barfing. What sort of volume are you using?
@PiePra "Could not read from remote repository" tells me not much. I don't have a repro that lets me understand what is happening.
If you have a repo that this reliably fails on and you want me to poke at it, I will. but absent that I am not sure how to even begin.
Any updates on this one? Cloning a private repo works, but syncing seems to error out frequently. In a very uncommon case the pods run normally.
"msg"="too many failures, aborting" "error"="Run(git ls-remote -q origin refs/heads/master): exit status 128: { stdout: \"\", stderr: \"fatal: Could not read from remote repository.\\n \\nPlease make sure you have the correct access rights\\nand the repository exists.\\n\" }" "failCount"=0Using apache airflow helm chart dags sync with a self hosted gitlab on a custom port so my git url is something like
ssh://[email protected]:2222/group/project.git
From Gitlab's usual ssh url format I'd say it should be: ssh://[email protected]:group/project.git and the port should be set via git options, I doubt ssh://[email protected]:2222:group/project.git would work, but might.
Any solution for this issue ? We are also facing the same issue. Following is the error message.
INFO: detected pid 1, running init handler
6/25/2021 8:01:10 AM I0625 12:01:10.405525 11 main.go:507] "level"=0 "msg"="starting up" "pid"=11 "args"=["/git-sync"]
6/25/2021 8:01:10 AM I0625 12:01:10.405643 11 main.go:860] "level"=0 "msg"="cloning repo" "origin"="[email protected]:xxxx/xxxx.git" "path"="/opt/airflow/dags"
6/25/2021 8:01:10 AM I0625 12:01:10.410489 11 main.go:866] "level"=0 "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/opt/airflow/dags"
6/25/2021 8:01:10 AM E0625 12:01:10.430887 11 main.go:172] "msg"="too many failures, aborting" "error"="unlinkat /opt/airflow/dags/.git/objects/pack/.nfs8811e9592a768dc80000003a: device or resource busy" "failCount"=0
Regards, Chandra.
So do I got the same issue.
INFO: detected pid 1, running init handler
I0228 08:39:39.516807 11 main.go:454] "level"=0 "msg"="starting up" "pid"=11 "args"=["/git-sync"]
I0228 08:39:39.517076 11 main.go:822] "level"=0 "msg"="cloning repo" "origin"="http://xxx/helm-charts" "path"="/tmp/git"
I0228 08:39:39.601382 11 main.go:828] "level"=0 "msg"="git root exists and is not empty (previous crash?), cleaning up" "path"="/tmp/git"
E0228 08:39:39.603261 11 main.go:504] "msg"="too many failures, aborting" "error"="unlinkat /tmp/git: device or resource busy" "failCount"=0
Do you resolve this issue?I use it as a init container.mout repo into a emptydir volume.Below is part of initContainer and container yaml.
initContainers:
- name: git-sync
volumeMounts:
- mountPath: /tmp/git
name: source
env:
- name: GIT_SYNC_DEPTH
value: "1"
- name: GIT_SYNC_ONE_TIME
value: "true"
- name: GIT_SYNC_USERNAME
valueFrom:
secretKeyRef:
name: platform-secret
key: GIT_SYNC_USERNAME
- name: GIT_SYNC_PASSWORD
valueFrom:
secretKeyRef:
name: platform-secret
key: GIT_SYNC_PASSWORD
containers:
- name: xxx
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080
name: http
envFrom:
volumeMounts:
- mountPath: /tmp/git
name: source
- mountPath: /etc/localtime
name: localtime
volumes:
- emptyDir: {}
name: source
- name: localtime
hostPath:
path: /etc/localtime