Stderr error could not lock config file git config permission denied

error: could not lock config file .git/config: Permission denied #675 Comments /.yadr to update and was greeted with the following error message error: could not lock config file .git/config: Permission denied The text was updated successfully, but these errors were encountered: I’m getting this issue with the most recent version. Edit: I was able […]

Содержание

  1. error: could not lock config file .git/config: Permission denied #675
  2. Comments
  3. error of «could not lock config file .git/config: Permission denied» due to unstaged changes; in Homebrew while installing openJDK 8
  4. 1 Answer 1
  5. Linked
  6. Related
  7. Hot Network Questions
  8. Subscribe to RSS
  9. Git’s famous «ERROR: Permission to .git denied to user»
  10. 17 Answers 17
  11. Here is what I did:
  12. Summary
  13. More details about my set up/situation/issue
  14. Error: Permission denied (publickey)
  15. In this article
  16. Help us make these docs great!

error: could not lock config file .git/config: Permission denied #675

/.yadr to update and was greeted with the following error message error: could not lock config file .git/config: Permission denied

The text was updated successfully, but these errors were encountered:

I’m getting this issue with the most recent version.

Edit: I was able to resolve using chmod .

Hey @scottenriquez could you elaborate for me? What did you do with chmod to fix?

Sorry for the late reply. If I remember correctly, I simply used the following command: chmod 777

/.yadr/.git/config to grant read, write, and execute to everyone. Depending on your setup, you may want to lock down the permissions a bit more. Also note that this is assuming that YADR has been installed in your home directory. If you used the install.sh script, you should be good to go.

/.yadr/.git/config to grant read, write, and execute to everyone. Depending on your setup, you may want to lock down the permissions a bit more. Also note that this is assuming that YADR has been installed in your home directory. If you used the install.sh script, you should be good to go. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub , or mute the thread .

I’m assuming some other tool reading/writing to that file (say Git Tower or whatever) changed the file permissions.

We didn’t have more complaints about this and it’s been a while, so I’m taking the liberty of closing this issue, ok? Feel free to reopen it if needed

this is my error. I cant even declare my global username and useremail

Rename from ‘C:/Users/mallioruganti/.gitconfig.lock’ to ‘C:/Users/mallioruganti/.gitconfig’ failed. Should I try again? (y/n) y

Corporate security policy prohibits writing to the «H:» path, directly. I have an «H:$user» directory that I can write to, however, the global (and GPO enforced) home directory variable is incomplete, and points to «H:» directly.

Because I have found no reasonably sane method to actually adjust the default location that the git for windows tool(s) use (I’ve tried 3 different packages, but they all seem to tie back to the same base project code). So I’m ‘stuck’.

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

I wasn’t able to create a local .gitconfig, since the windows GPO doesn’t allow viewing hidden files, or setting the extensions of files.
But I was able to use winSCP to copy my linux .gitconfig directly in to the local repo on windows and now I’m able to use my direct rubymine integration, and skip using the github desktop for windows interface. (though I am pointing rubymine to the git executable that comes with github desktop)

Источник

error of «could not lock config file .git/config: Permission denied» due to unstaged changes; in Homebrew while installing openJDK 8

I’m trying to install OpenJdk 8 on a MacOS recently updated to Mojave. The install command was

It results in the following error:

But when I do ‘git status’ from within the /usr/local/Homebrew directory, it says ‘nothing to commit, working tree clean’.

I looked at the hidden .git directories under/Homebrew. Before yesterday, it hadn’t been touched in a year. I don’t generally mess with it and haven’t used it to install anything in awhile.

1 Answer 1

The cannot rebase is a red herring—Git’s gotten confused by the earlier failure into thinking it needs to rebase around it, but the earlier failure is not because of changes. The actual problem is permission denied .

That problem means exactly what it says. You, as yourself, have no permission to modify these files. That means either you revoked your own permission, or you made these file as some other user. See How to fix homebrew permissions?

Linked

Hot Network Questions

To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Site design / logo © 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2023.1.14.43159

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

Источник

Git’s famous «ERROR: Permission to .git denied to user»

I have tried googling and read through https://help.github.com/en/articles/connecting-to-github-with-ssh and various, various guides. I am unable to git push -u origin master or git push origin master ( the same command ).

I’ve had my git account for at least 2 or so years. I’ve successfully been able to create repos and push -u origin master fine on my laptop but on this desktop I’m having issues.

Here’s what I tried:

1. I have setup my git user name

2. I have setup my git user email

3. I have uploaded the contents of my /home/meder/.ssh/id_rsa.pub to github’s account page. I have verified I did not paste any whitespace

4. I have created a

/.ssh/config with these contents:

I have chmodded the .ssh to 700, id_rsa 600

5. I have added the proper remote origin without making typos : git remote add origin git@github.com:medero/cho.git

6. To confirm #5, here is my .git/config. The directory is correct and not another directory:

7. ssh git@github.com -v gives me a successful Authentication

8. One weird thing is, the username which it greets me with has t appended to it. My github username is medero , not medert .

Hi mederot! You’ve successfully authenticated, but GitHub does not provide shell access.

9. I am not behind a proxy or firewall

10. The key is offered, heres the output from -v :

11. Here are the commands I used

12. I don’t want to create a new SSH key.

13. If I git clone using ssh and make an edit, commit, and git push, I get the same exact thing.

14. Here’s the actual error:

15. I have setup my github username and github token:

$ git config —global github.user medero $ git config —global github.token 0123456789yourf0123456789tokenSets the GitHub token for all git instances on the system

16. I have confirmed my github username is NOT mederot and my github token IS CORRECT per my account page ( validated first 2 chars and last 2 chars ).

17. To confirm #16,

18. I did ssh-key add

/.ssh/id_rsa if that’s even necessary.

THEORIES:

I suspect there’s something fishy because when I get ssh authenticated, the user greeting is mederot and not medero , which is my acct. Could something in my github account possibly be incorrectly cached?

I also suspect some local ssh caching weirdness because if i mv

/.ssh/id_rsa KAKA and mv

/.ssh/id_rsa.pub POOPOO , and do ssh git@github.com -v , it still Authenticates me and says it serves my /home/meder/.ssh/id_rsa when I renamed it?! It has to be cached?!

17 Answers 17

After Googling for few days, I found this is the only question similar to my situation.

However, I just solved the problem! So I am putting my answer here to help anyone else searching for this issue.

Here is what I did:

Open «Keychain Access.app» (You can find it in Spotlight or LaunchPad)

Select «All items» in Category

Search «git»

Delete every old & strange item

Try to Push again and it just WORKED

If problem is coming on windows then remove the Credentials from the Windows history.

  • Go to Credential Manager
  • Go to Windows Credentials
  • Delete the entries under Generic Credentials
  • Try connecting again.This time , it should prompt you for the correct username and password.

On Mac, if you have multiple GitHub logins and are not using SSH, force the correct login by using:

This also works if you’re having issues pushing to a private repository.

In step 18, I assume you mean ssh-add

/.ssh/id_rsa ? If so, that explains this:

I also suspect some local ssh caching weirdness because if i mv

/.ssh/id_rsa KAKA and mv

/.ssh/id_rsa.pub POOPOO, and do ssh git@github.com -v, it still Authenticates me and says it serves my /home/meder/.ssh/id_rsa when I renamed it?! It has to be cached?!

. since the ssh-agent is caching your key.

If you look on GitHub, there is a mederot account. Are you sure that this is nothing to do with you? GitHub shouldn’t allow the same SSH public key to be added to two accounts, since when you are using the git@github.com. URLs it’s identifying the user based on the SSH key. (That this shouldn’t be allowed is confirmed here.)

So, I suspect (in decreasing order of likelihood) that one of the following is the case:

  1. You created the mederot account previously and added your SSH key to it.
  2. Someone else has obtained a copy of your public key and added it to the mederot GitHub account.
  3. There’s a horrible bug in GitHub.

If 1 isn’t the case then I would report this to GitHub, so they can check about 2 or 3.

ssh-add -l check if there is more than one identify exists if yes, remove it by ssh-add -d «that key file»

Its due to a conflict.

Clear all keys from ssh-agent

Add the github ssh key

It should work now.

I am using Mac and the issue is solved by deleting github record from keychain access app: Here is what i did:

  1. Open «Keychain Access.app» (You can find it in Spotlight orLaunchPad)
  2. Select «All items» in Category
  3. Search «git»
  4. Delete every old & strange items Try to Push again and it just WORKED

Above steps are copied from @spyar for the ease.

I find the solution is the same as @spyar provide which is the Keychain Access app stored the old username.

There are 2 solutions for this situation:

  1. Delete the info in Keychain Access by
    • Open Keychain Access app
    • Search for GitHub
    • Delete corresponding credentials

If you want to use ssh key. You just change your Repo url from https

I recently ran into this issue for on old repo on my machine that had been pushed up using https. steps 5 and 6 solved my issue by re-setting the remote url for my repo from using the https url to the ssh url

checking the remote is using the https url

then re-setting the origin to use the ssh url

verifying new remote

could now successfully git push -u origin

i’m still not sure what setting i would have changed that might have caused the push to fail when the remote is https but this was the solution to my issue

I was running into similar issue on Mac OS.

Summary

  1. Make sure the repo gets cloned with correct/intended username
  2. If you try to clone a repo without specifying GitHub username, it picks up the GitHub username already cached in the OSX’s Keychain Access utility
  3. Hence I had to specify username while cloning the repo — git clone https://username@github.com/username/repository.git
  4. When it prompts to enter password, you may have to use a use a personal access token (PAT) because support for password authentication was removed on August 13, 2021 by GitHub. Here’s some documentation around personal access tokens (PAT) and how to set up and use
  5. The initial push might also require specifying username git push https://username@github.com/username/repository.git and providing PAT as password
  6. On subsequent pushes, no password would be prompted as they get cached to OSX Keychain Access util. Also, I didn’t have to use the full URL to push. Just git push
    worked fine

More details about my set up/situation/issue

Essentially I was trying to work with two different GitHub (github.com) accounts (1. Work account/email & 2. Personal account/email)

Mine was a little peculiar case because I had an existing SSH key generated with my personal email when our organization was on premise before migrating our repos to public github.com and that key was also configured for Bastion AWS (Amazon Web Services). I couldn’t regenerate a new key with the same email and also I did not generate a new key with work email which would have required to update the key configured for Bastion AWS

Note: My initial set up itself wasn’t correct because at that time I didn’t have much knowledge about how to work with or use SSH keys, so I realized I set them up incorrectly

Following approach worked for me (Note that this is a work around). I fell back to using GitHub Personal Access Token (PAT) instead.

Prompted password, I entered my PAT here (which then got cached to OSX Keychain Access)

On my subsequent pushes, no password prompts and I didn’t have to use the full URL to push. Just git push
worked fine

Источник

Error: Permission denied (publickey)

In this article

A «Permission denied» error means that the server rejected your connection. There could be several reasons why, and the most common examples are explained below.

Should the sudo command or elevated privileges be used with Git?

You should not be using the sudo command or elevated privileges, such as administrator permissions, with Git. If you have a very good reason you must use sudo , then ensure you are using it with every command (it’s probably just better to use su to get a shell as root at that point). If you generate SSH keys without sudo and then try to use a command like sudo git push , you won’t be using the same keys that you generated.

Check that you are connecting to the correct server

Typing is hard, we all know it. Pay attention to what you type; you won’t be able to connect to «githib.com» or «guthub.com». In some cases, a corporate network may cause issues resolving the DNS record as well.

To make sure you are connecting to the right domain, you can enter the following command:

The connection should be made on port 22, unless you’re overriding settings to use SSH over HTTPS.

Always use the «git» user

All connections, including those for remote URLs, must be made as the «git» user. If you try to connect with your GitHub username, it will fail:

If your connection failed and you’re using a remote URL with your GitHub username, you can change the remote URL to use the «git» user.

You should verify your connection by typing:

Make sure you have a key that is being used

  1. Open Terminal Terminal Git Bash .
  2. Verify that you have a private key generated and loaded into SSH.

If you have GitHub Desktop installed, you can use it to clone repositories and not deal with SSH keys.

If you are using Git Bash, turn on ssh-agent:

If you are using another terminal prompt, such as Git for Windows, turn on ssh-agent:

Verify that you have a private key generated and loaded into SSH.

  1. Open Terminal Terminal Git Bash .
  2. Verify that you have a private key generated and loaded into SSH.

The ssh-add command should print out a long string of numbers and letters. If it does not print anything, you will need to generate a new SSH key and associate it with GitHub.

Tip: On most systems the default private keys (

/.ssh/identity ) are automatically added to the SSH authentication agent. You shouldn’t need to run ssh-add path/to/key unless you override the file name when you generate a key.

Getting more details

You can also check that the key is being used by trying to connect to git@github.com :

In that example, we did not have any keys for SSH to use. The «-1» at the end of the «identity file» lines means SSH couldn’t find a file to use. Later on, the «Trying private key» lines also indicate that no file was found. If a file existed, those lines would be «1» and «Offering public key», respectively:

Verify the public key is attached to your account

You must provide your public key to GitHub to establish a secure connection.

Start SSH agent in the background.

Find and take a note of your public key fingerprint.

In the upper-right corner of any page, click your profile photo, then click Settings.

In the «Access» section of the sidebar, click

SSH and GPG keys.

Compare the list of SSH keys with the output from the ssh-add command.

Open the command line.

Start SSH agent in the background.

Find and take a note of your public key fingerprint.

In the upper-right corner of any page, click your profile photo, then click Settings.

In the «Access» section of the sidebar, click

SSH and GPG keys.

Compare the list of SSH keys with the output from the ssh-add command.

Start SSH agent in the background.

Find and take a note of your public key fingerprint. If you’re using OpenSSH 6.7 or older:

If you’re using OpenSSH 6.8 or newer:

In the upper-right corner of any page, click your profile photo, then click Settings.

In the «Access» section of the sidebar, click

SSH and GPG keys.

Compare the list of SSH keys with the output from the ssh-add command.

If you don’t see your public key in GitHub, you’ll need to add your SSH key to GitHub to associate it with your computer.

Warning: If you see an SSH key you’re not familiar with on GitHub, delete it immediately and contact GitHub Support, for further help. An unidentified public key may indicate a possible security concern. For more information, see «Reviewing your SSH keys.»

Help us make these docs great!

All GitHub docs are open source. See something that’s wrong or unclear? Submit a pull request.

Источник

Skip to content



Open


Issue created Aug 15, 2018 by Igor Yurev@iyurev

GitLab Runner OpenShift error: could not lock config file //.gitconfig: Permission denied

Summary

Summarize the bug encountered concisely

GitLab runner with kubernetes executor wont work with privileged = false container option .

Steps to reproduce

Configure GitLab runner for working with RH OpenShift platform , configmap :

  - kind: "ConfigMap"
    apiVersion: v1
    metadata:
      name: "${APP_NAME}"
      namespace: "${NAMESPACE}"
    data:
      config.toml: |
        concurrent = 1
        check_interval = 0

        [[runners]]
          name = "openshift"
          url = "https://gitlab.consto.com/"
          token = "${TOKEN}"
          executor = "kubernetes"
          [runners.cache]
          [runners.kubernetes]
            service-account = "runner-sa"
            bearer_token_overwrite_allowed = true
            image = ""
            namespace = "${NAMESPACE}"
            namespace_overwrite_allowed = ""
            privileged = false
            service_account_overwrite_allowed = ""
            pod_annotations_overwrite_allowed = ""

SCC for service account runner-sa:

  - kind: "SecurityContextConstraints"
    apiVersion: v1
    metadata:
      name: gitlab-runner
    allowPrivilegedContainer: yes
    runAsUser:
      type: RunAsAny
    seLinuxContext:
      type: RunAsAny
    fsGroup:
      type: RunAsAny
    supplementalGroups:
      type: RunAsAny

    allowHostDirVolumePlugin: true

    users:
    - system:serviceaccount:${NAMESPACE}:runner-sa

Pipelines running only if option privileged has true value , else
I get error : error: could not lock config file //.gitconfig: Permission denied

Actual behavior

What actually happens

Expected behavior

GitLab runner working with not privileged mode .

Relevant logs and/or screenshots

Running with gitlab-runner 11.1.0 (081978aa)
  on openshift ff568bcd
"BearerToken" overwritten with "XXXXXXXX..."
Using Kubernetes namespace: building-base-images
Using Kubernetes executor with image docker-registry.consto.com/openshift3/ose-ansible:latest ...
Waiting for pod building-base-images/runner-ff568bcd-project-20-concurrent-05qvzr to be running, status is Pending
Waiting for pod building-base-images/runner-ff568bcd-project-20-concurrent-05qvzr to be running, status is Pending
Running on runner-ff568bcd-project-20-concurrent-05qvzr via gitlab-runner-01-18-s9klb...
error: could not lock config file //.gitconfig: Permission denied
ERROR: Job failed: command terminated with exit code 1

Environment description

openshift 3.10
gitlab ee 11.0.3-ee (f25aa33)

Used GitLab Runner version

gitlab-runner 11.1.0 (081978aa)

I’m getting this error when trying to set the global config:

$ git config --global user.name "Your Name Here"
error: could not lock config file /pathto/file/.gitconfig: No such file or directory

and the file .gitconfig is already exists, anyone have any ideas??

asked Feb 19, 2013 at 17:06

codepros's user avatar

3

See if any of those tips help you:

  1. Verify if there’s some file called ~/.gitconfig.lock. If that’s the case just delete it.

  2. The file ~/.gitconfig belongs to you (use ls -la ~/.gitconfig to check). If it does not you can change the ownership using sudo chown <your_username>:<your_username> ~/.gitconfig

If none of these solves the problem you can always edit ~/.gitconfig using your favorite text editor. It is just a INI like file. An example:

$ cat ~/.gitconfig
[user]
    name = my_username
    email = me@email.com
[core]
    editor = editor
    pager = most
[color]
    ui = auto
[merge]
    conflictstyle = diff3

I am assuming the correct location is ~/.gitconfig. If that’s not the case replace it with the correct path.

Hope it helps.

answered Feb 19, 2013 at 17:31

Salem's user avatar

SalemSalem

19.4k6 gold badges62 silver badges89 bronze badges

3

In my case, there is a file .git/config.lock file in my git repo. I deleted that file and it solved the problem.

answered May 2, 2016 at 16:42

user3083108's user avatar

You need to own the directory where .gitconfig is in:

chown -R <user>.<user> /pathto/file/

That’s what worked for me.

answered Oct 1, 2013 at 7:32

jorge's user avatar

jorgejorge

311 bronze badge

My problem was similar to yours. I found that the «git» user was unable to access its home directory.

I did chown -R git:git /mnt/sdb1/git and this solved the permission error.

answered Aug 21, 2014 at 22:43

Rafael Diego Nicoletti's user avatar

For my case, my ~/.gitconfig file was pointing(symlinked) to my old dotfiles, which I had moved to a different location, meaning the gitconfig was pointing to an inexistent file.

To know where my gitconfig was symlinked to, I did ls -la ~/.gitconfig, which showed that it was pointing to a file I had moved elsewhere.

I had to update the symbolic link to my new dotfiles (dotfiles is just a folder name of all my .smth files).

To update the symlink, I did ln -sf ~/your-new/path-to/gitconfig.symlink ~/.gitconfig

Everything then worked well

answered Sep 20, 2019 at 20:24

Kaka Ruto's user avatar

In my case the error was:

error: could not lock config file .git/config: No such file or directory

I solved it by creating the .git directory:

mkdir -p ~/.git

BeastOfCaerbannog's user avatar

answered Nov 4, 2019 at 12:39

jessarah's user avatar

In my case I had to remove File config.lock inside my git repository .git/ folder.

answered Mar 3, 2020 at 14:03

StandardNerd's user avatar

My issue was that I mounted .gitconfig file in container from my local filesystem. It seems that way git stores gitconfig is by moving files around. It can not commit, because it can not move (not just write, but mv) temporary file into ~/.gitconfig .
My solution was to mount directory (home directory) and not just .gitconfig file.

answered Nov 19, 2021 at 14:50

ralu's user avatar

raluralu

1011 bronze badge

Понравилась статья? Поделить с друзьями:
  • Std regex error
  • Stc 1000 ошибка ee
  • Status brom cmd fail 0xc0060005 ошибка flashtool
  • Status brom cmd fail 0xc0060003 ошибка flashtool
  • Status 406 error not acceptable