git introduction
- GitHub is a hosting platform for open-source and private software projects, because it only supports git as the only version library format for hosting, so it is named GitHub.
- GitHub was officially launched on April 10, 2008. In addition to Git code warehouse hosting and basic Web management interface, it also provides subscription, discussion group, text rendering, online file editor, collaboration map (report), code fragment sharing (Gist) and other functions. At present, its registered users have exceeded 3.5 million, and the number of managed versions is also very large, including many well-known open source projects such as Ruby on Rails, jQuery, python, etc.
- On June 4, 2018, Microsoft announced the acquisition of GitHub, a code hosting platform, through a $7.5 billion stock exchange.
- In May 2019, the website of PC Magazine reported that GitHub was being invaded by a hacker. It is said that the hacker first erases the code repository, and then asks for ransom from the user as an exchange of recovered data.
git function
- Distributed version control;
- Multiple developers coordinate the work;
- Effectively monitor who makes changes;
- Local and remote operation;
git daily command
git Basic Order
git init // Initialize local warehouse
git add // Add files
git status // View state
git commit // Submission
git push // Push to warehouse
git pull // Pull data from remote warehouse
git clone // Copy data from remote warehouse
git install
https://git-scm.com/downloads
git start
- Create a new folder myapp locally, and cd it to myapp folder in command line mode
- Create the index.html file with the touch command on the command line
- User name mailbox needs to be configured for the first use
git config
global user.name 'ChangJun
git config --global user.email '779199489@qq.com
git add index.html // Add a file`
git status // You can use this command at any time during this process to view the status
git init // Add git directory
git rm --cached index.html // Delete added files
git add . // Upload all files
git commit -m '' // Upload and comment
git operation
touch .gitignore // Create git ignore file and write the file to ignore.
git branch login // Create branch
git checkout login // Switching branches
touch login.html
git add . // Upload to current branch
git remote add origin // Remote warehouse address
git remote // Check connection
git push -u origin master // upload
git file upload example
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
Error.java
MyFile.java
Position.java
ProcessByteStream.java
SelectByteStream.java
Token.java
nothing added to commit but untracked files present (use "git add" to track)
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git add *
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git push
error: src refspec refs/heads/master does not match any
error: failed to push some refs to 'https://github.com/Jianzhong2076/study.git'
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git commit 'add code'
error: pathspec 'add code' did not match any file(s) known to git
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git push
error: src refspec refs/heads/master does not match any
error: failed to push some refs to 'https://github.com/Jianzhong2076/study.git'
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file: Error.java
new file: MyFile.java
new file: Position.java
new file: ProcessByteStream.java
new file: SelectByteStream.java
new file: Token.java
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git commit 'add'
error: pathspec 'add' did not match any file(s) known to git
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git add *
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git commit 'all'
error: pathspec 'all' did not match any file(s) known to git
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ ^C
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git pull
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git branch
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git commit 'aa'
error: pathspec 'aa' did not match any file(s) known to git
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git commit -m 'aa'
*** Please tell me who you are.
Run
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
to set your account's default identity.
Omit --global to set the identity only in this repository.
fatal: unable to auto-detect email address (got 'bj_gj@LAPTOP-HP75CG0K.(none)')
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ ^C
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git config --global user.email "bj_gjz@qq.com"
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git config --global user.name "jianzhong2076"
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git commit -m 'aa'
[master (root-commit) 48e3447] aa
6 files changed, 460 insertions(+)
create mode 100644 Error.java
create mode 100644 MyFile.java
create mode 100644 Position.java
create mode 100644 ProcessByteStream.java
create mode 100644 SelectByteStream.java
create mode 100644 Token.java
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git push
fatal: unable to access 'https://github.com/Jianzhong2076/study.git/': Failed to connect to github.com port 443: Timed out
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git push
fatal: unable to access 'https://github.com/Jianzhong2076/study.git/': Failed to connect to github.com port 443: Timed out
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git config --global http.proxy http://127.0.0.1:1080
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git config --global https.proxy http://127.0.0.1:1080
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git push
fatal: unable to access 'https://github.com/Jianzhong2076/study.git/': Failed to connect to 127.0.0.1 port 1080: Connection refused
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git status
On branch master
Your branch is based on 'origin/master', but the upstream is gone.
(use "git branch --unset-upstream" to fixup)
nothing to commit, working tree clean
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git pull
fatal: unable to access 'https://github.com/Jianzhong2076/study.git/': Failed to connect to 127.0.0.1 port 1080: Connection refused
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git pull
fatal: unable to access 'https://github.com/Jianzhong2076/study.git/': Failed to connect to 127.0.0.1 port 1080: Connection refused
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ ^C
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git config --global --unset http.proxy
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git pull
Your configuration specifies to merge with the ref 'refs/heads/master'
from the remote, but no such ref was fetched.
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git pull
fatal: 'origin master' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git pull
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$ git push
fatal: TaskCanceledException encountered.
▒▒ȡ▒▒һ▒▒▒▒▒▒
jianzhongGjzEnumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 8 threads
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 5.26 KiB | 2.63 MiB/s, done.
Total 8 (delta 0), reused 0 (delta 0)
To https://github.com/Jianzhong2076/study.git
* [new branch] master -> master
bj_gj@LAPTOP-HP75CG0K MINGW64 /d/code/study (master)
$