Git & Git Bash the course of the common mistakes Summary (personally resolved)

Use some of the problems encountered Git bash solution

1.warning: LF will be replaced by CRLF in package.json ( because of the presence of the symbol escaped problem).
At The Original File by Will have have the ITS Line Endings in your Working Directory.
Solved: git config --global core.autocrlf true (when core autocrlf is true, there is a need to carefully place, when you upload a binary file, Git binaries might mistake it for a text file, which will modify your binary files, creating hazards)

2.On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)

nothing to commit, working tree clean (which is the root cause of the problem version of the branches)

3. When the git push origin branch_name encounter given as follows:

fatal:'origin' does not appear to be a git repository

fatal:Could not read from remote repository

the reason:

Local branch and a remote branch disconnected

Solution:
cd local branch in
(1), git Branch
- * master display only master

Then see if pulled from the upstream
(2), git Remote -v
- if nothing is upstream and has been broken contact, can not pull the code can not be pushed Code

Plus correlation
(3), git remote add origin ssh: //[email protected] ( address)

And
(4), Origin FETCH git
- pull-down situation appears branch of
checking remote repository again, the display address corresponding clone
git Remote -v
--origin git: //github.com/schacon/ticgit.git (FETCH)
Origin git: //github.com/schacon/ticgit.git (push)

Then check branch
git branch -a

        ——* mater

Tip "Already up-to-date" when 4.master Merge branch
(git pull Origin Master
the From https://github.com/pandaliusir/pandaliusir.github.io

  • master Branch -> FETCH_HEAD
    Already up to DATE).
    In the current use Git branch into master prompts "Already up-to-date" , but the current master branch and branch code are not synchronized. Suppose the current branch is: dev, a main branch: master.
    Solution:
    git Checkout Master;
    git the RESET --hard dev;
    git the Push --force Origin Master

5.在执行git pull origin master时出现:
  fatal: 'origin' 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

Solution:
git git @ GitHub Remote the Add Origin: bx_reader / BX-Reader-api.git

Associate remote warehouse origin, then enter:
git the Push -u Origin Master
can be submitted

 ssh-keygen -t rsa -C "[email protected] " ( fill in your e-mail address) Enter
Next comes the way to enter could :()
  Generating public / Private Key pair rsa.
  the Enter the Save to File in Which the key (/root/.ssh/id_rsa):
after opening the tips of the directory
C: \ Users \ liusi.ssh
Notepad to open
id_rsa.pub,
copy the contents of which
enter their account https://github.com/settings/keys click New sshKey, copy and paste the contents to Key, the title can not write.

Verify: $ ssh -T [email protected] Enter
  Hi XXXXX You've successfully authenticated, but GitHub does not provide shell access!.
  Success
6.git transmit local content to a remote repository appears [rejected] master -> master ( fetch first) error
problem: git push -u command to the remote database name master content submitted by local spread to remote git repository error occurs:

Command: git push -u origin master

出现错误:
  To https://github.com/imjinghun/university.git
  ! [rejected] master -> master (fetch first)
  error: failed to push some refs to 'https://github.com/imjinghun/university.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.

解决:git pull --rebase origin master
git push origin master

Guess you like

Origin www.cnblogs.com/lookabc/p/12523553.html