Helen
Helen

Reputation: 317

git cannot open .git/FETCH_HEAD

I have CentOs. I make git and made owner's .git folders group "gitdevelopers". In group "gitdevelopers" add User1 and User2. Now i make git-push and git-pull change from user1 and user2. But users in your computers not work with error:

git.exe pull -v --no-rebase --progress "origin" error: cannot open .git/FETCH_HEAD: Permission denied

Why?

p.s.:And i can connect to server by x-shell with login-password user1 and user2.

few hours later:: I think problem in not right login-password, which git remember.

p.p.s: where git save login-password pairs? I use ssh-protocol.

p.p.p.s.:OK. I have server CentOs with git. On server is two users. And I use TortoiseGit for windows. I configure this so : in each connect system asked login and password for connect to server. And now I wanted know : 1. where is saved this login-password 2. i can permanently saved this pair?

Upvotes: 20

Views: 76539

Answers (6)

Sudhir Rao
Sudhir Rao

Reputation: 19

Delete the existing solution and doing a git clone solved the issue for me

Upvotes: 0

user178088
user178088

Reputation: 1

this worked for me:

sudo chown -R $ USER: name_repo

note: in my case I had cloned the repository with the root user and then I started using another user

Upvotes: 0

Suresh Shinde
Suresh Shinde

Reputation: 107

Generating a new SSH key pair

ssh-keygen -o -t rsa -b 4096 -C "[email protected]"

Adding an SSH key to your GitLab account

Copy your public SSH key to the clipboard and paste it into your user account >  SSH Keys 

For Authentication you need to set configuration in ~/.ssh/config as content bellow;

Host domain.com

Hostname domain.com

User git

Port 30001

Preferredauthentications publickey

RequestTTY no

IdentityFile ~/.ssh/id_rsa

You can use commands as; In these command mentioned common variables, replace the related values of those.

Create a new repository

git clone ssh://[email protected]:port-number/user-name/project-name.git

cd project-name

touch README.md

git add README.md

git commit -m "add README"

git push -u origin master

Push an existing folder

cd existing_folder

git init

git remote add origin ssh://[email protected]:port-number/user-name/project-name.git

git add .

git commit -m "Initial commit"

git push -u origin master

Push an existing Git repository

cd existing_repo

git remote rename origin old-origin

git remote add origin ssh://[email protected]:port-number/user-name/project-name.git

git push -u origin --all

git push -u origin --tags

To clone repository:

git clone https://[email protected]:port-number/user-name/project-name.git

Upvotes: 0

Pablo Papalardo
Pablo Papalardo

Reputation: 1312

This worked with me

sudo chown -R $(whoami) .git/

Upvotes: 64

Mohamed Salman
Mohamed Salman

Reputation: 321

if you are using ubuntu, use sudo key word before.

sudo git pull

if you are using windows, use administrator mode

Upvotes: 4

Rizwan
Rizwan

Reputation: 4433

you can check for the permissions on the file,

ls -l /usr/local/Library/Taps/linode/cli/.git/FETCH_HEAD

and

ls -l /usr/local/.git/FETCH_HEAD

Upvotes: 2

Related Questions