I'm trying to write a shell script in linux that pulls all the files from a git repository that were committed in the latest commit. The way I do that is to run a git fetch to get the latest commit inof, then git show to capture the file names, then I pull the specific files individually. The script needs to be run by multiple users, all with access to the git repo. I had it set up to ask for the username and password, then would run:
git fetch "https://USER:PASSWORD@GIT_URL"
This would work but was not getting the latest commit always. I found that git fetch (no parameters) was working and found this Q/A explaining the difference: git fetch vs. git fetch origin master have different effects on tracking branch
So, I changed the script so it just calls git fetch, and the user enters his/her password when prompted (it asks, Password for, "https://USER@GIT_URL": ). The issue now is that other users are being asked for MY password. I thought the USER would be taken from the system login. Does anyone know how I can get ONLY the files changed in the latest commit without running into these issues? Thank you.