Git config ( git config
) Command
Setting your username in Git
$git config user.email "Your user name"
Setting your user email in Git
$git config user.email "Your user email"
Verifying your username in Git
$git config user.name
Setting user name and email for every repository on your computer, try following command
$ git config user.name "Your user name here"
Verify that it is set or not, type the following command
$ git config user.name
Same for email id
How to set up/link a local git repository with remote repoisotry for push and pull
git config user.name 'your github user name'
This will set the user name in your local repository, but not globaly, for gloabal configuration run the following
git config --global user.name 'your github user name'
git remote set-url origin 'git@github.com:krishnaiitd/gitcommands.git'
$ git config user.name 'your github user name'
This will set the user name in your local repository, but not globaly, for gloabal configuration run the following
$ git config --global user.name 'your github user name'
$ git remote set-url origin 'git@github.com:krishnaiitd/gitcommands.git'
This will set the remote origin url for fetching, pull and push
Working With fork repository
Let consider when you have forked a reporitory so you probably have no permission to commit in the upstream repo. i.e from where you have forked.
In this case, you need to set a uptream remote url for fetch and pulling once you have sync your reporisotry from uptream you
can push to the forked repo i.e origin and then make a pull request for merging into the main upstream repo.
git remote add upstream 'git@github.com:krishnaiitd/tweepy.git'
If you have already upstream url, then use following command to change it
git remote set-url upstream 'git@github.com:krishnaiitd/tweepy.git'
This will set the remote upsteam url for fetching and pulling
Now in this case you have fetch and pull from upstream as follow
git fetch upstream BranchName
git pull upstream pull BranchName
To push the changes into origin type the following command
git push origin BranchName
$ git remote add upstream 'git@github.com:krishnaiitd/tweepy.git'
If you have already upstream url, then use following command to change it
$ git remote set-url upstream 'git@github.com:krishnaiitd/tweepy.git'
This will set the remote upsteam url for fetching and pulling
Now in this case you have fetch and pull from upstream as follow
$ git fetch upstream BranchName
$ git pull upstream pull BranchName
To push the changes into origin type the following command
$ git push origin BranchName
git config user.name 'your github user name'
This will set the user name in your local repository, but not globaly, for gloabal configuration run the following
git config --global user.name 'your github user name'
$ git config user.name 'your github user name'
This will set the user name in your local repository, but not globaly, for gloabal configuration run the following
$ git config --global user.name 'your github user name'
Setting your username in Git
$ git config user.email "Your user name"
Setting your user email in Git
$ git config user.email "Your user email"
Verifying your username in Git
$ git config user.name
displayed set username here
Setting user name and email for every repository on your computer, try following command
$ git config user.name "Your user name here"
Verify that it is set or not, type the following command
$ git config user.name