I'd like to create a very simple shell script, which will ultimately be called by another application, that updates a local git repository:
#!/bin/bash
cd $1
sudo git pull
When executing this I'm asked for credentials (I'm pulling from a private BitBucket repository).
Can I ( briefly) store credentials in environment variables?
#!/bin/bash
export GIT_USERNAME=<user>
export GIT_PASSWORD=<pass>
cd $1
sudo git pull
The above doesn't work. Would anything? I could programmatically modify the origin url but that seems a bit execessive.
question from:https://stackoverflow.com/questions/8536732/can-i-hold-git-credentials-in-environment-variables