简体   繁体   中英

Unable to pull latest code from git on ubuntu server

I'm trying to pull changes from my git branch onto an Ubuntu server. For some reason, I'm getting this error when trying to pull:

ubuntu@ip-xxx-xx-xx-xx:/var/www/html/prod/dist$ git pull
Username for 'https://github.com': my_name
Password for 'https://my_name@github.com':
remote: Counting objects: 1082, done.
remote: Compressing objects: 100% (96/96), done.
fatal: Unable to create temporary file '/var/www/html/prod/dist/.git/objects/pack/tmp_pack_XXXXXX': Permission denied
fatal: index-pack failed

Any thoughts on why this is occuring? Thanks in advance.

The user you're executing the command as ( ubuntu judging from your prompt), doesn't have permission to create the temporary file in question.

You can inspect the current permissions of the pack directory by running the following command:

$ ls -ld .git/objects/pack
drwxr-xr-x 2 chuckx chuckx 4096 May 28 22:51 .git/objects/pack

Based on the results you can decide what to do. Some options include:

  • run the command as a user with permissions
  • recursively change the ownership of the directory to give the ubuntu user permission to write (ie chown -R ubuntu .git

Looks like you have permission problems locally to write inside /var/www/html/prod/dist/.git/ . Check that you are using a user that has RW access over there.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM