Trouble setting up Tower with my GitHub Account - error: could not lock config file

纵然是瞬间 提交于 2020-02-13 09:03:09

问题


I've been using the GitHub for Mac app but on the suggestion of a friend, decided to give Tower a shot since it can also handle Beanstalk accounts as well.

After installing the trial and putting in my GitHub username and password, I'm given this error:

error: could not lock config file /Users/joshferrara/.gitconfig: Permission denied

I was just curious if anyone knows what's causing this or if it has any relevance to me using Tower. Any help is greatly appreciated!


Permissions on the file:

-rw-rw-rw- 1 joshferrara staff 130 Nov 22 17:14 /Users/joshferrara/.gitconfig

Permissions on the parent directory:

drwxr-xr-x 74 501 staff 2516 Apr 26 14:46 /Users/joshferrara

回答1:


I was facing the same issue. I renamed my .gitconfig file to "xyz.gitconfig" And I found that git created a new .gitconfig file. I was not facing the error anymore.




回答2:


It turned out to be an odd permission issue between the .gitconfig file that Github for Mac created with root privileges and Tower wasn't able to access.

A simple change of ownership privileges fixed the problem. Ownership can be changed like so:

sudo chown -R username [file|directory]

Explanation:

  • sudo - grant root privileges
  • chown - changes the ownership
  • -R - for recursive changing of files
  • username - username of new owner
  • [file|directory] - file or directory for change to occur (if directory is specified it's going to recursively change all the files inside)



回答3:


You mentioned global read/write permissions on the .gitconfig file, and those are enough to edit it. But those aren't enough to create a new file in that directory, which is what the git config tool I am guessing you were using was trying to do.

Now changing the permissions in your home directory might not be an option. It wasn't for me just now googling for this question, for instance, since I'm working on a webserver. So I went into my home account on my own computer, copied my stuff from the gitinfo file there, and pasted it into the .gitinfo file in the locked down account.

To save you a step, most of the time we're using git config, we're doing it to set our name and e-mail on systems that require that to use git. So if that's what you were trying, here's the .gitinfo file's contents. Edit your .gitconfig file with your favorite editor, paste this stuff in, change it to reflect you, and you'll be able to use git without any more complaining :

  [user]
    email = nobody@nowhere.com
    name = Joe Schmoe



回答4:


Look for .gitconfig.lock file at your home directory, if you find any remove it. Issue got resolved for me.



来源:https://stackoverflow.com/questions/10340581/trouble-setting-up-tower-with-my-github-account-error-could-not-lock-config-f

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!