GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Windows] Create_submodule fails due to use of hidden files · Issue #516 · gitpython-developers/GitPython

[Windows] Create_submodule fails due to use of hidden files #516

New issue
Copy link
New issue
Copy link
Closed
Closed
[Windows] Create_submodule fails due to use of hidden files#516
Copy link
Labels
acknowledgedtag.Windowswaiting for feedback

Description

@matthewwardrop
matthewwardrop
opened on Sep 22, 2016
Issue body actions

On Windows, the .git files are given the hidden attribute. If a file is marked as hidden, it cannot be written to using the standard Python open(..., 'w') command. This is because the underlying win32 api errors unless the attributes of the open command match the attributes of the file, and this is not exposed in the Python API

For example, consider the following snippet:

import git
r = git.Repo('test')
r.create_submodule(name='testing', path='testing', url='https://github.com/matthewwardrop/python-parampy')

On Unix, this works fine. In Windows, however, it will crash with the following stack trace:

Traceback (most recent call last):
  ...
  File "c:\program files\python35\lib\site-packages\git\repo\base.py", line 306, in create_submodule
    return Submodule.add(self, *args, **kwargs)
  File "c:\program files\python35\lib\site-packages\git\objects\submodule\base.py", line 389, in add
    mrepo = cls._clone_repo(repo, url, path, name, **kwargs)
  File "c:\program files\python35\lib\site-packages\git\objects\submodule\base.py", line 253, in _clone_repo
    cls._write_git_file_and_module_config(module_checkout_path, module_abspath)
  File "c:\program files\python35\lib\site-packages\git\objects\submodule\base.py", line 292, in _write_git_file_and_mod
ule_config
    fp = open(git_file, 'wb')
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\matthewwardrop\\test\\testing\\.git'

There's probably a workaround using the raw git commands, but it would be nice to have this cleaned up.

Activity

  1. Byron
    added
    acknowledged
    on Sep 25, 2016
  2. Byron commented on Sep 25, 2016

    @Byron
    Byron
    on Sep 25, 2016
    Member
    More actions

    Thanks for letting me know. If you can come up with a solution that works for you, I would be very happy about a PR. Windows is not a platform I can test on, and am therefore dependent on contributions in that realm.

  3. ankostis commented on Oct 1, 2016

    @ankostis
    ankostis
    on Oct 1, 2016
    Contributor
    More actions

    @matthewwardrop this must have been fixed by #519 (b8b025f) where the file gets deleted before overwritting it.
    I had the same problem, but I couldn't understand why this was happening; thanks for the tip!

    Anyway, please check if it is ok, before closing the issue.

  4. Byron
    added
    waiting for feedback
    on Oct 9, 2016
  5. Byron commented on Mar 8, 2017

    @Byron
    Byron
    on Mar 8, 2017
    Member
    More actions

    I am closing this issue as it had no interaction for more than 3 months. Please feel free to comment in case you need it to be reopened.

  6. Byron
    closed this as completedon Mar 8, 2017
  7. ankostis
    added
    tag.Windows
    on Mar 8, 2017
  8. matthewwardrop commented on Mar 10, 2017

    @matthewwardrop
    matthewwardrop
    on Mar 10, 2017
    Author
    More actions

    @Byron @ankostis Thanks for fixing this. Sorry for the huge delay. I don't often use Windows, so I guess I never got around to checking this. Given that things seem to work for you in appveyor, and people have not been reporting bugs against my project (the knowledge repo), it looks like these issues have been fixed. I really appreciate it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedtag.Windowswaiting for feedback

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402520 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.