Bootstrap FreeKB - Git (Version Control) - Create user defined git configurations
Git (Version Control) - Create user defined git configurations

Updated:   |  Git (Version Control) articles

The most basic way to use Git is to use the git clone command to clone an origin Git repository (such as example.git) to a directory on your PC (such as /home/john.doe/git), make a change to a file in the cloned repository on your PC (such as example.txt), use the git commit command to commit the change to the file, and to then use the git push command to upload the file to the origin Git repository.

Let's say you have cloned a Git repository and then you use the git add command to add a file to the currently selected branch of the cloned repository before using the git config command to set your users username and email. This should cause something like this to be returned.

]$ sudo git commit -m "adding to git for the first time" example.txt
[master (root-commit) ede7348] adding to git for the first time
 Committer: root <root@localhost>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly. Run the
following command and follow the instructions in your editor to edit
your configuration file:

    git config --global --edit

After doing this, you may fix the identity used for this commit with:

    git commit --amend --reset-author

 1 file changed, 277 insertions(+)
 create mode 100644 nginx/conf/default.conf

 

The git config command can be used to set your username and email, as well as other values.

git config --global user.name "John Doe"
git config --global user.email "john.doe@example.com"

 

The git config command with the -l or --list option can then be used to display the configurations that have been set.

~]# git config --list
user.name="John Doe"
user.email="john.doe@example.com"



Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 1074cd in the box below so that we can be sure you are a human.