I created a couple of aliases that looks like this:
The idea being I can save my credentials (email, username) in the alias definition. Then when I want to clone or initialise, I don't have to perform a git config
every time.
when initialising:
initgithub = !git init && git config user.email [youremailfor@github.com] && git config user.name [yourgithubusername]
initbitbucket = !git init && git config user.email [youremailfor@bitbucket.com] && git config user.name [yourbitbucketusername]
when cloning:
clonegithub = "!f() { git clone $1 $2; cd $2; git config user.email [youremailfor@github.com]; git config user.name [yourgithubusername]; }; f"
clonebitbucket = "!f() { git clone $1 $2; cd $2; git config user.email [youremailfor@bitbucket.com]; git config user.name [yourbitbucketusername]; }; f"
ussage:
when initialising:
git initgithub
git initbitbucket
when cloning:
git clonegithub https://github.com/pathtoproject.git /c/temp/somefolder/project
git clonebitbucket https://github.com/pathtoproject.git /c/temp/somefolder/project
When cloning you can basically create a function that will execute both the normal clone operation and the config operations. For now it requires that you provide the path to the folder you are cloning to in order to configure your credentials properly.