FETCH_HEAD is a short-lived ref, to keep track of what has just been fetched from the remote repository. git pull first invokes git fetch , in normal cases fetching a branch from the remote; FETCH_HEAD points to the tip of this branch (it stores the SHA1 of the commit, just as branches do).
The Bash permission denied error indicates you are trying to execute a file which you do not have permission to run. To fix this issue, use the chmod u+x command to give yourself permissions. If you cannot use this command, you may need to contact your system administrator to get access to a file.
2 answers. Yes you can delete FETCH_HEAD files. They are only temporary.
git pull origin master will pull changes from the origin remote, master branch and merge them to the local checked-out branch. git pull origin/master will pull changes from the locally stored branch origin/master and merge that to the local checked-out branch.
It seems like the first one isn't working because your user doesn't have the permissions for changing that directory, and the second because your root user doesn't have the right SSH keys for accessing that git repository.
Depending on what you're trying to do, it might be better to clone the repository to a different directory, or maybe chown
the current directory to have full access for your user
Check if you have enough permissions on the .git/
directory. You should have write permissions. You can set them with the following command.
Go to your project folder:
chown -R youruser:yourgroup .git/
If you want to give the permission to the group,
sudo chmod g+w .git -R
worked best for me.
For MacOS
sudo chmod -R g+w .git
This is a UNIX permission problem. Do not use sudo
for cloning the repository. You don't have the same ssh keys as root and you shouldn't work as root anyway. Try ls -la
to find the permissions on the files and use chmod
(or sudo chown
) to fix them. Hope that helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With