Git实战二

Git实战二_第1张图片

Git实战二_第2张图片


Administrator@MS-20170301NRCW MINGW64 /d
$ mkdir learngit


Administrator@MS-20170301NRCW MINGW64 /d
$ cd learngit


Administrator@MS-20170301NRCW MINGW64 /d/learngit
$ git init
Initialized empty Git repository in D:/learngit/.git/


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git add file1.txt test1.txt


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master


No commits yet


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


        new file:   file1.txt
        new file:   test1.txt




Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git commit -m "commit success"
[master (root-commit) 62e1272] commit success
 2 files changed, 4 insertions(+)
 create mode 100644 file1.txt
 create mode 100644 test1.txt


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
nothing to commit, working tree clean


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote add origin [email protected]:MyGitHubHpu/python7.git


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote
origin


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$  git push -u origin master
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (4/4), 301 bytes | 150.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To github.com:MyGitHubHpu/python7.git
 * [new branch]      master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git clone [email protected]:MyGitHubHpu/gitskills.git
Cloning into 'gitskills'...
ERROR: Repository not found.
fatal: Could not read from remote repository.


Please make sure you have the correct access rights
and the repository exists.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git clone [email protected]:MyGitHubHpu/gitskills.git
Cloning into 'gitskills'...
ERROR: Repository not found.
fatal: Could not read from remote repository.


Please make sure you have the correct access rights
and the repository exists.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$  ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Zp0G8dNZ/82ZlJJyausUuNnMIExw57LHan9VcpnGtJ0 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|     . ...    .  |
|      o oo . o.o.|
|       o..o.o+ooB|
|      o +o.o+.oE*|
|       +S=++  =o+|
|       o+.O o.   |
|       o o *.    |
|      . . o.     |
|         ...     |
+----[SHA256]-----+


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git clone [email protected]:MyGitHubHpu/Git-Test1.git
Cloning into 'Git-Test1'...
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.


Please make sure you have the correct access rights
and the repository exists.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ ssh-keygen -t rsa -c "[email protected]"
Too many arguments.
usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa]
                  [-N new_passphrase] [-C comment] [-f output_keyfile]
       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f keyfile]
       ssh-keygen -i [-m key_format] [-f input_keyfile]
       ssh-keygen -e [-m key_format] [-f input_keyfile]
       ssh-keygen -y [-f input_keyfile]
       ssh-keygen -c [-P passphrase] [-C comment] [-f keyfile]
       ssh-keygen -l [-v] [-E fingerprint_hash] [-f input_keyfile]
       ssh-keygen -B [-f input_keyfile]
       ssh-keygen -D pkcs11
       ssh-keygen -F hostname [-f known_hosts_file] [-l]
       ssh-keygen -H [-f known_hosts_file]
       ssh-keygen -R hostname [-f known_hosts_file]
       ssh-keygen -r hostname [-f input_keyfile] [-g]
       ssh-keygen -G output_file [-v] [-b bits] [-M memory] [-S start_point]
       ssh-keygen -T output_file -f input_file [-v] [-a rounds] [-J num_lines]
                  [-j start_line] [-K checkpt] [-W generator]
       ssh-keygen -s ca_key -I certificate_identity [-h] [-U]
                  [-D pkcs11_provider] [-n principals] [-O option]
                  [-V validity_interval] [-z serial_number] file ...
       ssh-keygen -L [-f input_keyfile]
       ssh-keygen -A
       ssh-keygen -k -f krl_file [-u] [-s ca_public] [-z version_number]
                  file ...
       ssh-keygen -Q -f krl_file file ...


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$  ssh-keygen -t rsa -C "[email protected]"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:dSwES/IVZenCT4TiUgHnwPybMpgzUelNK5XltUSItDQ [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|     o++E*=**.   |
|      =OBBo=o.   |
|     o B=++o+    |
|    . + =.ooo    |
|     + oSo +     |
|    = o o   .    |
|     o o         |
|                 |
|                 |
+----[SHA256]-----+


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$  git remote add origin [email protected]:MyGitHubHpu/python7.git
fatal: remote origin already exists.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remove rm origin
git: 'remove' is not a git command. See 'git --help'.


The most similar command is
        remote


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote rm origin


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote add origin [email protected]:MyGitHubHpu/python7.git


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git pull origin master
From github.com:MyGitHubHpu/python7
 * branch            master     -> FETCH_HEAD
 * [new branch]      master     -> origin/master
Already up to date.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)


        deleted:    file1.txt
        deleted:    test1.txt


no changes added to commit (use "git add" and/or "git commit -a")


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git commit -m "sss"
On branch master
Changes not staged for commit:
        deleted:    file1.txt
        deleted:    test1.txt


no changes added to commit


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git pull origin master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:MyGitHubHpu/python7
 * branch            master     -> FETCH_HEAD
   62e1272..17e4e87  master     -> origin/master
Updating 62e1272..17e4e87
Fast-forward
 newfile | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 newfile


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git add test


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)


        deleted:    file1.txt
        deleted:    test1.txt


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


        Test/


no changes added to commit (use "git add" and/or "git commit -a")


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git commit -a
Aborting commit due to empty commit message.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)


        deleted:    file1.txt
        deleted:    test1.txt


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


        Test/


no changes added to commit (use "git add" and/or "git commit -a")


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git add Test/
warning: LF will be replaced by CRLF in Test/.idea/Test.iml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Test/.idea/modules.xml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Test/.idea/workspace.xml.
The file will have its original line endings in your working directory.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD ..." to unstage)


        new file:   Test/.idea/Test.iml
        new file:   Test/.idea/modules.xml
        new file:   Test/.idea/workspace.xml
        new file:   Test/Test.py
        new file:   Test/my.py
        new file:   Test/tools.py


Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)


        deleted:    file1.txt
        deleted:    test1.txt




Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git commit
Aborting commit due to empty commit message.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
Changes to be committed:
  (use "git reset HEAD ..." to unstage)


        new file:   Test/.idea/Test.iml
        new file:   Test/.idea/modules.xml
        new file:   Test/.idea/workspace.xml
        new file:   Test/Test.py
        new file:   Test/my.py
        new file:   Test/tools.py


Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)


        deleted:    file1.txt
        deleted:    test1.txt




Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git pull origin master
From github.com:MyGitHubHpu/python7
 * branch            master     -> FETCH_HEAD
Already up to date.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git push origin master
Everything up-to-date


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git push -u origin master
Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 'origin'.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git branch
* master


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git branch dev


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git checkout dev
Switched to branch 'dev'
A       Test/.idea/Test.iml
A       Test/.idea/modules.xml
A       Test/.idea/workspace.xml
A       Test/Test.py
A       Test/my.py
A       Test/tools.py
D       file1.txt
D       test1.txt


Administrator@MS-20170301NRCW MINGW64 /d/learngit (dev)
$ git checkout master
Switched to branch 'master'
A       Test/.idea/Test.iml
A       Test/.idea/modules.xml
A       Test/.idea/workspace.xml
A       Test/Test.py
A       Test/my.py
A       Test/tools.py
D       file1.txt
D       test1.txt
Your branch is up to date with 'origin/master'.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git status
On branch master
Your branch is up to date with 'origin/master'.


Changes to be committed:
  (use "git reset HEAD ..." to unstage)


        new file:   Test/.idea/Test.iml
        new file:   Test/.idea/modules.xml
        new file:   Test/.idea/workspace.xml
        new file:   Test/Test.py
        new file:   Test/my.py
        new file:   Test/tools.py


Changes not staged for commit:
  (use "git add/rm ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in working directory)


        deleted:    file1.txt
        deleted:    test1.txt




Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git push -u origin master
Everything up-to-date
Branch 'master' set up to track remote branch 'master' from 'origin'.


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote
origin


Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)
$ git remote -v
origin  [email protected]:MyGitHubHpu/python7.git (fetch)
origin  [email protected]:MyGitHubHpu/python7.git (push)

 

 

 

 

Administrator@MS-20170301NRCW MINGW64 /d/learngit (master)

 

 

 

============================================================



Administrator@MS-20170301NRCW MINGW64 ~/.ssh
$ git config --global user.name "MyGitHubHpu"


Administrator@MS-20170301NRCW MINGW64 ~/.ssh
$ git config --global user.email "[email protected]"


Administrator@MS-20170301NRCW MINGW64 ~/.ssh
 

 

你可能感兴趣的:(GIT)