- OS Version:
- Installing Git:
- Git Version:
- Creating Git Configuration file:
1. No "/root/.gitconfig" file till now:
[root@git-server ~]# cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core)
- Installing Git:
[root@git-server ~]# yum install git -y
- Git Version:
[root@git-server ~]# git --version git version 1.8.3.1
- Creating Git Configuration file:
1. No "/root/.gitconfig" file till now:
[root@git-server ~]# pwd /root [root@git-server ~]# ls -la total 2097196 dr-xr-x---. 6 root root 4096 Dec 26 18:49 . dr-xr-xr-x. 17 root root 4096 Dec 14 20:38 .. -rw-------. 1 root root 990 Dec 26 19:15 .bash_history -rw-r--r--. 1 root root 18 Dec 14 23:34 .bash_logout -rw-r--r--. 1 root root 176 Dec 14 23:34 .bash_profile -rw-r--r--. 1 root root 176 Dec 14 23:34 .bashrc drwx------. 3 root root 16 Sep 23 22:55 .cache -rw-r--r--. 1 root root 100 Dec 14 23:34 .cshrc -rw-------. 1 root root 274 Dec 26 19:15 .lesshst drwxr-xr-x. 2 root root 53 Dec 26 18:44 orig_files drwxr-----. 3 root root 18 Jan 7 2015 .pki drwx------. 2 root root 28 Dec 19 2014 .ssh -rw-r--r--. 1 root root 2147483648 Jan 7 2015 swap -rw-r--r--. 1 root root 129 Dec 14 23:34 .tcshrc -rw-------. 1 root root 6314 Dec 26 18:49 .viminfo2. Create the username and e-mail address for your Git:
[root@git-server ~]# git --help
usage: git [--version] [--help] [-c name=value]
[--exec-path[=path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
The most commonly used git commands are:
add Add file contents to the index
bisect Find by binary search the change that introduced a bug
branch List, create, or delete branches
checkout Checkout a branch or paths to the working tree
clone Clone a repository into a new directory
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
fetch Download objects and refs from another repository
grep Print lines matching a pattern
init Create an empty Git repository or reinitialize an existing one
log Show commit logs
merge Join two or more development histories together
mv Move or rename a file, a directory, or a symlink
pull Fetch from and merge with another repository or a local branch
push Update remote refs along with associated objects
rebase Forward-port local commits to the updated upstream head
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
show Show various types of objects
status Show the working tree status
tag Create, list, delete or verify a tag object signed with GPG
'git help -a' and 'git help -g' lists available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
[root@git-server ~]# git help -a
usage: git [--version] [--help] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p|--paginate|--no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
available git commands in '/usr/libexec/git-core'
add credential-store instaweb prune shell
add--interactive describe log prune-packed shortlog
am diff lost-found pull show
annotate diff-files ls-files push show-branch
apply diff-index ls-remote quiltimport show-index
archive diff-tree ls-tree read-tree show-ref
bisect difftool mailinfo rebase stage
bisect--helper difftool--helper mailsplit receive-pack stash
blame fast-export merge reflog status
branch fast-import merge-base relink stripspace
bundle fetch merge-file remote submodule
cat-file fetch-pack merge-index remote-ext subtree
check-attr filter-branch merge-octopus remote-fd symbolic-ref
check-ignore fmt-merge-msg merge-one-file remote-ftp tag
check-ref-format for-each-ref merge-ours remote-ftps tar-tree
checkout format-patch merge-recursive remote-http unpack-file
checkout-index fsck merge-resolve remote-https unpack-objects
cherry fsck-objects merge-subtree remote-testpy update-index
cherry-pick gc merge-tree repack update-ref
clean get-tar-commit-id mergetool replace update-server-info
clone grep mktag repo-config upload-archive
column hash-object mktree request-pull upload-pack
commit help mv rerere var
commit-tree http-backend name-rev reset verify-pack
config http-fetch notes rev-list verify-tag
count-objects http-push pack-objects rev-parse web--browse
credential imap-send pack-redundant revert whatchanged
credential-cache index-pack pack-refs rm write-tree
credential-cache--daemon init patch-id send-pack
credential-gnome-keyring init-db peek-remote sh-i18n--envsubst
'git help -a' and 'git help -g' lists available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
[root@git-server ~]# git help config
GIT-CONFIG(1) Git Manual GIT-CONFIG(1)
NAME
git-config - Get and set repository or global options
[...]
--global
For writing options: write to global /.gitconfig file rather than the repository .git/config, write to $XDG_CONFIG_HOME/git/config file
if this file exists and the/.gitconfig file doesn’t.
For reading options: read only from global ~/.gitconfig and from $XDG_CONFIG_HOME/git/config rather than from all available files.
See also the section called “FILES”.
[root@git-server ~]# git config --global user.name "Root User" [root@git-server ~]# git config --global user.email "root@localhost"3. Now, you have "/root/.gitconfig" file:
root@git-server ~]# pwd /root [root@git-server ~]# ls -la total 2097200 dr-xr-x---. 6 root root 4096 Dec 26 19:18 . dr-xr-xr-x. 17 root root 4096 Dec 14 20:38 .. -rw-------. 1 root root 1131 Dec 26 19:18 .bash_history -rw-r--r--. 1 root root 18 Dec 14 23:34 .bash_logout -rw-r--r--. 1 root root 176 Dec 14 23:34 .bash_profile -rw-r--r--. 1 root root 176 Dec 14 23:34 .bashrc drwx------. 3 root root 16 Sep 23 22:55 .cache -rw-r--r--. 1 root root 100 Dec 14 23:34 .cshrc -rw-r--r--. 1 root root 49 Dec 26 19:18 .gitconfig -rw-------. 1 root root 274 Dec 26 19:15 .lesshst drwxr-xr-x. 2 root root 53 Dec 26 18:44 orig_files drwxr-----. 3 root root 18 Jan 7 2015 .pki drwx------. 2 root root 28 Dec 19 2014 .ssh -rw-r--r--. 1 root root 2147483648 Jan 7 2015 swap -rw-r--r--. 1 root root 129 Dec 14 23:34 .tcshrc -rw-------. 1 root root 6314 Dec 26 18:49 .viminfo
[root@git-server ~]# cat .gitconfig [user] name = Root User email = root@localhost4. You can list it also from Git:
[root@git-server ~]# git config --list user.name=Root User user.email=root@localhost
No comments:
Post a Comment