Giter Club home page Giter Club logo

Comments (6)

thockin avatar thockin commented on July 19, 2024

from git-sync.

Analect avatar Analect commented on July 19, 2024

Can you post a complete but minimal repro?

@thockin ... sorry for delay in coming back to you on this.

I created a repro repo here: https://github.com/Analect/test-sync
It uses the same demo as this repo .. ie. git-sync/hugo/nginx
It differs a bit from the demo on here in that it's adding ssh via shared etc\secret-git folder and the github-git-creds (the private key used to access github ... eventhough I've left this project as public) is added to my kubernetes cluster using: kubectl create secret generic github-git-creds --from-file=ssh=/home/user/.ssh/id_rsa

Just run up the pod from /test-sync/demo/config: kubectl create -f pod.yaml

Run: kubectl exec -it blog-pod -c hugo /bin/bash to enter the hugo container.

I'm trying to emulate my use-case here ... where my main app (to which I add git-sync as a sidecar) has a terminal from which I want to be able to interact with the remote repo using git.

Navigate to src folder:
This seems to suggest that src is a git folder

root@blog-pod:/src# ls
git  rev-024e5cfc2ac5fec2fef5a5901ad9e8038d8509da
root@blog-pod:/src# git remote -v 
origin	[email protected]:Analect/test-sync.git (fetch)
origin	[email protected]:Analect/test-sync.git (push)
root@blog-pod:/src# git show --summary
commit 024e5cfc2ac5fec2fef5a5901ad9e8038d8509da
Date:   Mon Mar 20 13:09:40 2017 +0000

    changing path for where to find themes

However, if you run a git-status from this folder, it shows the following ... that it will delete all these files ... and instead track the two subfolders git and rev-024e5cfc2ac5fec2fef5a5901ad9e8038d8509da which is obviously not what I want.

root@blog-pod:/src# git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	deleted:    README.md
	deleted:    demo/blog/archetypes/.keep
	deleted:    demo/blog/config.toml
	deleted:    demo/blog/content/about.md
	deleted:    demo/blog/content/post/first.md
	deleted:    demo/blog/layouts/.keep
	deleted:    demo/blog/static/.keep
	deleted:    demo/blog/themes/dimension/.gitignore
	deleted:    demo/blog/themes/dimension/LICENSE.md
	deleted:    demo/blog/themes/dimension/README.md
	deleted:    demo/blog/themes/dimension/archetypes/default.md
	deleted:    demo/blog/themes/dimension/exampleSite/config.toml
	deleted:    demo/blog/themes/dimension/exampleSite/content/about.de.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/about.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/contact.de.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/contact.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/elements.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/formspree.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/intro.de.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/intro.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/work.de.md
	deleted:    demo/blog/themes/dimension/exampleSite/content/work.md
	deleted:    demo/blog/themes/dimension/exampleSite/static/images/pic01.jpg
	deleted:    demo/blog/themes/dimension/exampleSite/static/images/pic02.jpg
	deleted:    demo/blog/themes/dimension/exampleSite/static/images/pic03.jpg
	deleted:    demo/blog/themes/dimension/images/screenshot.png
	deleted:    demo/blog/themes/dimension/images/tn.png
	deleted:    demo/blog/themes/dimension/layouts/404.html
	deleted:    demo/blog/themes/dimension/layouts/_default/list.html
	deleted:    demo/blog/themes/dimension/layouts/_default/onepagestyle.html
	deleted:    demo/blog/themes/dimension/layouts/_default/single.html
	deleted:    demo/blog/themes/dimension/layouts/index.html
	deleted:    demo/blog/themes/dimension/layouts/partials/footer.html
	deleted:    demo/blog/themes/dimension/layouts/partials/header.html
	deleted:    demo/blog/themes/dimension/layouts/robots.txt
	deleted:    demo/blog/themes/dimension/layouts/shortcodes/gmaps.html
	deleted:    demo/blog/themes/dimension/layouts/shortcodes/socialLinks.html
	deleted:    demo/blog/themes/dimension/layouts/sitemap.xml
	deleted:    demo/blog/themes/dimension/static/css/font-awesome.min.css
	deleted:    demo/blog/themes/dimension/static/css/ie9.css
	deleted:    demo/blog/themes/dimension/static/css/main.css
	deleted:    demo/blog/themes/dimension/static/css/noscript.css
	deleted:    demo/blog/themes/dimension/static/css/project.css
	deleted:    demo/blog/themes/dimension/static/fonts/FontAwesome.otf
	deleted:    demo/blog/themes/dimension/static/fonts/fontawesome-webfont.eot
	deleted:    demo/blog/themes/dimension/static/fonts/fontawesome-webfont.svg
	deleted:    demo/blog/themes/dimension/static/fonts/fontawesome-webfont.ttf
	deleted:    demo/blog/themes/dimension/static/fonts/fontawesome-webfont.woff
	deleted:    demo/blog/themes/dimension/static/fonts/fontawesome-webfont.woff2
	deleted:    demo/blog/themes/dimension/static/images/bg.jpg
	deleted:    demo/blog/themes/dimension/static/images/overlay.png
	deleted:    demo/blog/themes/dimension/static/js/jquery.min.js
	deleted:    demo/blog/themes/dimension/static/js/main.js
	deleted:    demo/blog/themes/dimension/static/js/skel.min.js
	deleted:    demo/blog/themes/dimension/static/js/util.js
	deleted:    demo/blog/themes/dimension/static/sass/base/_page.scss
	deleted:    demo/blog/themes/dimension/static/sass/base/_typography.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_box.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_button.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_form.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_icon.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_image.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_list.scss
	deleted:    demo/blog/themes/dimension/static/sass/components/_table.scss
	deleted:    demo/blog/themes/dimension/static/sass/ie9.scss
	deleted:    demo/blog/themes/dimension/static/sass/layout/_bg.scss
	deleted:    demo/blog/themes/dimension/static/sass/layout/_footer.scss
	deleted:    demo/blog/themes/dimension/static/sass/layout/_header.scss
	deleted:    demo/blog/themes/dimension/static/sass/layout/_main.scss
	deleted:    demo/blog/themes/dimension/static/sass/layout/_wrapper.scss
	deleted:    demo/blog/themes/dimension/static/sass/libs/_functions.scss
	deleted:    demo/blog/themes/dimension/static/sass/libs/_mixins.scss
	deleted:    demo/blog/themes/dimension/static/sass/libs/_skel.scss
	deleted:    demo/blog/themes/dimension/static/sass/libs/_vars.scss
	deleted:    demo/blog/themes/dimension/static/sass/main.scss
	deleted:    demo/blog/themes/dimension/static/sass/noscript.scss
	deleted:    demo/blog/themes/dimension/theme.toml
	deleted:    demo/blog/themes/hyde/LICENSE.md
	deleted:    demo/blog/themes/hyde/README.md
	deleted:    demo/blog/themes/hyde/archetypes/default.md
	deleted:    demo/blog/themes/hyde/images/screenshot.png
	deleted:    demo/blog/themes/hyde/images/tn.png
	deleted:    demo/blog/themes/hyde/layouts/404.html
	deleted:    demo/blog/themes/hyde/layouts/_default/list.html
	deleted:    demo/blog/themes/hyde/layouts/_default/single.html
	deleted:    demo/blog/themes/hyde/layouts/index.html
	deleted:    demo/blog/themes/hyde/layouts/partials/disqus.html
	deleted:    demo/blog/themes/hyde/layouts/partials/head.html
	deleted:    demo/blog/themes/hyde/layouts/partials/sidebar.html
	deleted:    demo/blog/themes/hyde/static/apple-touch-icon-144-precomposed.png
	deleted:    demo/blog/themes/hyde/static/css/hyde.css
	deleted:    demo/blog/themes/hyde/static/css/poole.css
	deleted:    demo/blog/themes/hyde/static/css/syntax.css
	deleted:    demo/blog/themes/hyde/static/favicon.png
	deleted:    demo/blog/themes/hyde/theme.toml
	deleted:    demo/config/pod.yaml

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	git
	rev-024e5cfc2ac5fec2fef5a5901ad9e8038d8509da/

If I navigate down a level into /src/git, it tells me this is no longer a git folder.

root@blog-pod:/src/git# git show --summary
fatal: Not a git repository: ../.git/worktrees/rev-024e5cfc2ac5fec2fef5a5901ad9e8038d8509da

Maybe I'm misunderstanding what the objective of git-sync is. My use-case is to take an initial pull from a repo and then from the cloned folder (which is shared via volume) to be able to interact directly back with the remote repo using git. However, there's some transformation that's happening the cloned folder which makes it unworkable.

I'm hoping this makes things a bit clearer for you.

from git-sync.

stp-ip avatar stp-ip commented on July 19, 2024

The issue as far as I understand is by design.

git-sync usage is pull based. So the main usage is just to pull in content into a local directory not to push it back again.

If the only issue you are having is concerning the usage of symlinks, which messes up the directory structure you could try using the GIT_SYNC_ATOMIC to false.

For now I would say this is a won't fix as the tool is working as intended. If it works via turning off atomic switched, a PR to document this use case could be accepted.

This PR would most likely add the following:

  • docs/push.md as file for the docs
  • add steps to use git-sync for writing back to the git repo
  • add limitations around not using atomic sync (as a warning on top)

from git-sync.

stp-ip avatar stp-ip commented on July 19, 2024

Closing for now. If your issue was misunderstood, please feel free to reopen.

It is definitely an interesting use-case and a PR can be submitted separately.

from git-sync.

Analect avatar Analect commented on July 19, 2024

@stp-ip
I ran up the pod with the GIT_SYNC_ATOMIC set to false (see settings lower down), but it doesn't appear to change the behaviour. I was looking in main.go for evidence of the parameter GIT_SYNC_ATOMIC and wasn't able to find any. Am I missing something? The only other mention of it in this repo is in isssue #15.

image

spec:
  containers:
  - env:
    - name: GIT_SYNC_REPO
      value: [email protected]:Analect/test-sync.git
    - name: GIT_SYNC_DEST
      value: git
    - name: GIT_SYNC_SSH
      value: "true"
    - name: GIT_SYNC_WAIT
      value: "99999"
    - name: GIT_SYNC_ATOMIC
      value: "false"
    image: gcr.io/google_containers/git-sync:v2.0.4
    imagePullPolicy: Always
    name: git-sync

from git-sync.

stp-ip avatar stp-ip commented on July 19, 2024

You are right. Switching the atomic operation via the mentioned flag isn't available. Will open another issue to get that tracked. So for now no pushing back to your repo via git-sync possible. As I said, just not the main use-case for git-sync.

from git-sync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.