I have followed the instructions to set up a private git respository on my raspeberry pi. All goes well until I try

git push pi master

at that point I get the following error:

fatal: Unable to create temporary file '/mnt/data/git-repos/sublime.git/./objects/pack/tmp_pack_XXXXXX': Permission denied

My system details are

Distributor ID: Debian Description: Debian GNU/Linux 7.8 (wheezy) Release: 7.8 Codename: wheezy

I am logging in to git with the same account pi that I used to set up the respository directory on the raspberry pi. On the raspberry pi I needed to use sudo to set up the directory. How do I give access to my git login to access the directory?

2 Answers 2


This is a pretty basic unix permission error. If you had to use sudo to create the folder, that folder is then owned by the root user account. To change that, you need to use the chown (change ownership) command.

Try: sudo chown pi:pi -R /path/to/folder_here

The command above will change the ownership (both user and group) to your user.


I had a similar issue, and Jacobm001's answer didn't work for me, so I thought I'd add my solution in case it helps anyone else. Its a partial solution as I am still unable to remotely create a git repo, but I can clone an existing repo from github and then use git to push/pull changes to this repo.

I followed these instructions to set up Git on my Pi. However, I encountered an error when trying to remotely add my repo.

$ git remote add origin [email protected]/twesleyb/myRepo.git
$ git push -u origin master

ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

The solution, as suggested here, was to insure that my Pi's SSH key was set up properly:

$ ls ~/.ssh
$ ssh-keygen
# Copy the entire key generated with:
$ cat ~/.ssh/id_rsa.pub

Paste your entire SSH key into GitHub > Account > Settings > SSH and GPG Keys. Create a new repository on GitHub, and then clone this in your pi.

git clone [email protected]:twesleyb/myRepo.git

Hopefully you can now work with this repo on your pi!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.