could not open git/commit_editmsg

前端 未结 6 1744
自闭症患者
自闭症患者 2021-01-12 17:43

I have a git repository linked to a dropbox folder. Recently, I have switched my laptop to another, and now i can not perform the function \"git commit -am\". I keep getting

相关标签:
6条回答
  • 2021-01-12 18:14

    I had same issue, here the steps , how I solved the issue.

    1) first checked the file permission( and found, only root having access )

    $ls -l .git/COMMIT_EDITMSG

    -rw-r--r-- 1 root root 13 Jun 11 07:54 .git/COMMIT_EDITMSG

    2) logged in as root and changed file permission

    # chown arun:arun .git/COMMIT_EDITMSG ( here arun is my username, refer chown command for more details )

    3) Now file permission changed and able to commit without any issues !

    $ls -l .git/COMMIT_EDITMSG

    -rw-r--r-- 1 arun arun 12 Jun 16 11:47 .git/COMMIT_EDITMSG

    0 讨论(0)
  • 2021-01-12 18:21

    This is an file permission issue, user you are currently logged on does not have permissions to use the files.

    If that's your repo, you may try:

    • switching to other user who owns the repo
    • changing the owner of the repo (sudo chown youruser -R yourrepodir/)
    • changing the permissions for the particular files using chmod (you should avoid using 0777 as it is not secure)
    0 讨论(0)
  • 2021-01-12 18:22

    I had this issue when I had a git repo inside a git repo in a working copy.. hope that helps

    0 讨论(0)
  • 2021-01-12 18:31

    Ensure that the git app you use (whether GUI, cmd or bash) is running as an Administrator. This of course apply if you are using Windows.

    0 讨论(0)
  • 2021-01-12 18:32

    try this git init --shared=0777

    0 讨论(0)
  • 2021-01-12 18:36

    Assuming you're on a Windows machine, the chances are that you modified a hidden file and no longer have write permissions to the hidden file.

    To solve this, simply navigate to your .git folder and delete the "COMMIT_EDITMSG" file.

    0 讨论(0)
提交回复
热议问题