github simple command entry and common errors

github simple command entry and common errors:

First, the entry commonly used commands
git init (create a new empty warehouse)
git the Add. (All files are added folder)
git the Add file name (specified file add folder)
git Status (Check status)
git the commit -m " annotation "(add documents submitted Remarks)
git the Add remote Origin Storage link address (connect remote warehouse)
git remote RM Origin warehouse address (delete remote repository)
cd directory address (the next target directory)
LS (listed in the current directory all files)
mkdir folder name (new file in the current directory folder)
RM -r folder name (using the command to delete a folder)
SSH-keygen -t rsa -C "and github account binding mailbox" (configure SSH keys)
git the Push -u Origin Master (warehouse is empty, upload the file)
git the Push Origin Master (when not empty warehouse, uploading files)
git pull --rebase Origin Master (incorporated)
dir (see directory file under)
git pull Origin Master (the file on github again pulled down)
git RM -r --cached filename (deleting files on the disk)
gi t rm filename (delete from repository)
git the commit -m "delete the file name" (Adding removal instructions)
git add -A (upload all modifications)
git the commit -a -m "change the comment" (add a file update instructions)
git the Push Origin Master -f (file upload update)
git the Push -u Origin Master (update github repository)
git log (see change log)
git remote (see remote library information)
git remote -v (see remote database for more detailed information)
branch:
git branch branch name (create a branch)
git branch Checkout name (switching branch)
git Checkout -b branch name (create change Gache branch)
git branch (see the current branch)
git Checkout master (switch back to the master branch)
git merge branch name (merging a branch to the current branch)
git branch -d branch name (deleted branches)

Second, the entry-operating common errors
1, enter: git remote add origin when the warehouse link address
error: fatal: Not a git repository ( or any of the parent directories): .git
Solution: Enter the git init, to initialize a local repository
2, input: git remote add origin when the warehouse link address
error: fatal: remote origin already exists.
solution:
delete origin information Git repository: git remote rm origin
re-add origin information Git repository
3, enter: git push origin master when the
error: fatal: 'Origin' does not appear to git Repository BE A
fatal: Could not the Read from Remote repository.Please the make the Sure you have have at The correct at The Repository and Access Rights EXISTS.
solution: re-enter git remote add origin warehouse link address
4, enter: git push origin master when the
error: fatal: remote error:
[email protected]/myarea is not a valid repository name Email [email protected] for help
Solution: use git remote rm origin and then use the upload command
5, enter: git push origin master when the
error: To git @ git. oschina.net:yangzhi/hello.git
! [Rejected] Master -> Master (FETCH First)
error: faled the Push some refs to 'warehouse address'
solution: this issue occurs because README.md github file that is not in native code directory. The combined first code git pull --rebase origin master then perform Origin Master Push Git
. 6, input: Git add ./ when
given: fatal: Not a git repository ( or any of the parent directories): .git
solution: first input git init, and then the Add ./ git
7, enter: git push origin master when the
error: error: failed to push some refs to ...
Workaround: enter the git pull origin master (first pull down a remote file server github above ), then enter the git push origin master

These are only the entry of individual learning, specially from the Internet to collect a summary of these commands and error, though not comprehensive, but there is enough of their own, later also when fully deepened their understanding, which describe inappropriate or if other errors, but also Please inform caring people to be corrected.

Guess you like

Origin blog.51cto.com/14235507/2422177