Git 配置记录

``
[johnson@localhost mmall]$ touch README.md
[johnson@localhost mmall]$ touch .gitignore
[johnson@localhost mmall]$ git init
Initialized empty Git repository in /home/johnson/IdeaProjects/mmall/.git/
[johnson@localhost mmall]$ git status
On branch master

Initial commit

Untracked files:
(use "git add <file>..." to include in what will be committed)

    .gitignore
    README.md
    out/
    pom.xml
    src/
    web/

nothing added to commit but untracked files present (use "git add" to track)
[johnson@localhost mmall]$ git add.
git: 'add.' is not a git command. See 'git --help'.

Did you mean this?
add
[johnson@localhost mmall]$ git add .
[johnson@localhost mmall]$ git status
On branch master

Initial commit

Changes to be committed:
(use "git rm --cached <file>..." to unstage)

    new file:   .gitignore
    new file:   README.md
    new file:   out/artifacts/mmall_Web_exploded/META-INF/MANIFEST.MF
    new file:   out/artifacts/mmall_Web_exploded/WEB-INF/web.xml
    new file:   out/artifacts/mmall_Web_exploded/index.jsp
    new file:   pom.xml
    new file:   src/main/webapp/WEB-INF/web.xml
    new file:   src/main/webapp/index.jsp
    new file:   web/WEB-INF/web.xml
    new file:   web/index.jsp

[johnson@localhost mmall]$ git commit -am 'fisrt commit init '
[master (root-commit) f56ef87] fisrt commit init
Committer: johnson.ski johnson@localhost.localdomain
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

10 files changed, 107 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 out/artifacts/mmall_Web_exploded/META-INF/MANIFEST.MF
create mode 100644 out/artifacts/mmall_Web_exploded/WEB-INF/web.xml
create mode 100644 out/artifacts/mmall_Web_exploded/index.jsp
create mode 100644 pom.xml
create mode 100644 src/main/webapp/WEB-INF/web.xml
create mode 100644 src/main/webapp/index.jsp
create mode 100644 web/WEB-INF/web.xml
create mode 100644 web/index.jsp
[johnson@localhost mmall]$ git remote add origin git@github.com:jansony1/mmall.git
[johnson@localhost mmall]$ git branch

  • master
    [johnson@localhost mmall]$ git push -u origin master
    The authenticity of host 'github.com (192.30.255.113)' can't be established.
    RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
    Are you sure you want to continue connecting (yes/no)? yes
    Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
    To github.com:jansony1/mmall.git
    ! [rejected] master -> master (fetch first)
    error: failed to push some refs to 'git@github.com:jansony1/mmall.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    [johnson@localhost mmall]$ git pull
    Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.
    warning: no common commits
    remote: Counting objects: 4, done.
    remote: Compressing objects: 100% (3/3), done.
    remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
    Unpacking objects: 100% (4/4), done.
    From github.com:jansony1/mmall

  • [new branch] master -> origin/master
    There is no tracking information for the current branch.
    Please specify which branch you want to merge with.
    See git-pull(1) for details.

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> master

[johnson@localhost mmall]$ git push -u origin master
To github.com:jansony1/mmall.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:jansony1/mmall.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[johnson@localhost mmall]$ git push -u -f origin master
Counting objects: 20, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (12/12), done.
Writing objects: 100% (20/20), 2.00 KiB | 0 bytes/s, done.
Total 20 (delta 0), reused 0 (delta 0)
To github.com:jansony1/mmall.git

  • 60fb02d...f56ef87 master -> master (forced update)
    Branch master set up to track remote branch master from origin.
    [johnson@localhost mmall]$ git branch
  • master
    [johnson@localhost mmall]$ git branch -r
    origin/master
    [johnson@localhost mmall]$ git checkout -b v1.0 origin/master
    Branch v1.0 set up to track remote branch master from origin.
    Switched to a new branch 'v1.0'
    [johnson@localhost mmall]$ git branch
    master
  • v1.0
    [johnson@localhost mmall]$ git push origin HEAD -u
    Total 0 (delta 0), reused 0 (delta 0)
    To github.com:jansony1/mmall.git
  • [new branch] HEAD -> v1.0
    Branch v1.0 set up to track remote branch v1.0 from origin.
    [johnson@localhost mmall]$
    ``
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容