What to do if:
I’ve got the following error executing ‘git clone’ command on my Mac High Sierra machine?
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Execute the following command: xcode-select --install
I accidentally deleted a file and pushed the changes to Git server?
1. Find all commits that deleted the file
git log --diff-filter=D –summary
Example:
olympus:comp2217-f2014-aroudik aroudik$ git log --diff-filter=D --summary commit 952be58e8b5bd228167199e98d5365aa8a44e310 Author: Andrei Roudik <aroudik@cs.du.edu> Date: Wed Nov 12 16:05:37 2014 -0700 removing new file delete mode 100644 TEST/newfile
2. To restore your deleted file use
git checkout [commmit ID]^ -- <file_path>
Example:
git checkout 952be58e8b5bd228167199e98d5365aa8a44e310^ -- TEST 3. Add your restored file to the repository, commit and push git add * git commit -m "file restored" git push
4. Verify your last commit
olympus:comp2217-f2014-aroudik aroudik$ git log -1 --stat commit d8467bb3b11eefe23138496fec0894c4beb249a4 Author: Andrei Roudik <aroudik@cs.du.edu> Date: Thu Nov 13 10:40:14 2014 -0700 file restored TEST/newfile | 1 + 1 file changed, 1 insertion(+)
I’ve got a message “Access denied” after ‘git push -u origin master’ execution?
This message usually indicates that your SSH public key is not accepted for some reason.
The easiest way to fix is to regenerate a new SSH key as it explained at step 3 in step by step setup instructions here.