Category Archives: Linux

Git Pull Error: Please specify which branch you want to merge with.

$git pull

$ git pull
warning: no common commits
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (5/5), done.
From github.com:nonfuxinyang/android-study
* [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

Seeing the second tip, we now know a solution. That is to specify the link relationship between the current working directory, working branch, and remote warehouse and branch& lt; br>

For example, we set the master branch corresponding to the remote warehouse

git branch –set-upstream master origin/master

So every time we want to push or pull, we just need to input git push or git pull

Before that, we have to specify the remote branch that we want to push or pull

git push origin master

git pull origin master.

 

[Solved] Git conflict Error: commit your changes or stash them before you can merge

Git conflict: commit your changes or stash them before you can merge

When updating the code with git pull, we encountered the following problems:

error: Your local changes to the following files would be overwritten by merge:
*********************************************************
Please, commit your changes or stash them before you can merge.
Aborting

The reason for this problem is that other people have modified xxx.php and submitted it to the version library, and you have also modified xxx.php locally. At this time, if you do git pull, there will be a conflict. The solution is very clear in the above prompt

1. Retain local modification

1) Direct commit local modification — this method is not generally used

2) Through git stash — usually this way

git stash
git pull
git stash pop

Restore the work area to the last submitted content through git stash, and back up the local changes at the same time. After git pull is completed, execute git stash pop to apply the previous local changes to the current work area

Git stash: back up the content of the current workspace, read the relevant content from the latest submission, and make the workspace consistent with the content submitted last time. At the same time, save the current workspace content to git stack

Git stash Pop: read the last saved content from git stack and recover the related content of workspace. Since there may be multiple stash contents, the stack is used to manage them. Pop will read the contents from the latest stash and recover them

Git stash list: displays all the backups in Git stack. You can use this list to decide where to recover from

Git stash clear: clear git stack. At this point, using gitg and other graphical tools, you will find that the original stash nodes have disappeared

2. Discard the local modification – this method discards the local modification and cannot be retrieved

git reset --hardgit pull< br>& lt; br>& lt; br>& lt; br>& lt; br>& lt; br>

Git Unable to switch remote branches error: pathspec ‘origin/XXXX’ did not match any file(s) known to git

At the end of the article, we can see the solution directly

The following is the problem handling process, taking switching to the master branch as an example

There are only some local branches. If you want to switch to other remote branches, you will get an error:

$ git checkout master
error: pathspec 'master' did not match any file(s) known to git
$ git checkout origin/master
error: pathspec 'origin/master' did not match any file(s) known to git

Check all the branches and find that there is no branch you want to switch

$ git branch -a
* dev
  remotes/origin/dev

Fetch all branches

git fetch --all #fetch all branches

Then git branch - a finds that there is still no branch to switch, and tries to directly fetch the specified branch

$ git fetch master
fatal: '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.

Indicates that the branch does not exist. Check the warehouse and find that the branch has not been removed and still exists

Check the file Project path /. Git/config , and find that remote only adds a single branch

[remote "origin"]
	url = http://XXXXXXXXXXX/XXXXXXXXXXX.git
	fetch = +refs/heads/dev:refs/remotes/origin/dev

Amend to read

[remote "origin"]
	url = http://XXXXXXXXXXX/XXXXXXXXXXX.git
	fetch = +refs/heads/*:refs/remotes/origin/*

Once again, fetch branch, successfully solve the problem

$ git fetch --all
Fetching origin
From http://XXXXXXXXXXX/XXXXXXXXXXX
 * [new branch]      master     -> origin/master
 
$ git branch -a
* dev
  remotes/origin/dev
  remotes/origin/master
  
$ git checkout master
Switched to a new branch 'master'
Branch 'master' set up to track remote branch 'master' from 'origin'.

[Solved] Git push origin master fatal: ‘origin’ does not appear to be a git repository fatal…

 

git add *

git status

git commit -m "upload your codes"

git push origin master   
error git push 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.


git remote add origin [email protected]:names/xiansun-manager-service.git

git push origin master

How to Fix Git push warning: push.default is unset;

warning: push.default is unset; its implicit value is changing in
Git 2.0 from ‘matching’ to ‘simple’. To squelch this message
and maintain the current behavior after the default changes, use:

git config –global push.default matching

To squelch this message and adopt the new behavior now, use:

git config –global push.default simple

See ‘git help config’ and search for ‘push.default’ for further information.
(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode
‘current’ instead of ‘simple’ if you sometimes use older versions of Git)

Everything up-to-date

 

Here’s the difference between push.default matching and push.default simple.

The push.default setting maching means that git push will push all your local branches to the remote host with the corresponding name. This means that you might inadvertently push some branches that you didn’t intend to push.

Setting push.default to simple means that git push only pushes the branch you are currently on to the branch you pulled from git pull in the first place, and it also checks to see if the names of the branches are the same.

 

[How to Solve] Push rejected: Push to origin/master was rejected

The solution is as follows:

1. Switch to the directory where your project is located, right-click to select git bash here, ALT + F12

can be used in idea

2. In the terminl window, enter the command in turn:

2

git pull

git pull origin master

git pull origin master –allow-unrelated-histories

3. Push your project again in idea, success

If not: git push – U origin master – F

Git Connect Error: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).

I want to pull remote project to local

E:\files\github\gmdropship>git pull git@ip:username/ship_web.git
git@ip's password:
Permission denied, please try again.
git@ip's password:
Permission denied, please try again.
git@ip's password:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

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

Found repeatedly asked to enter the password, the password is right, but still show no authority. To view the SSH connection log:

E:\files\github\gmdropship>ssh -vT git@ip
OpenSSH_for_Windows_7.6p1, LibreSSL 2.6.4
debug1: Reading configuration data C:\\Users\\Micky/.ssh/config
debug1: Connecting to ip [ip] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\Micky/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file C:\\Users\\Micky/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_7.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to ip:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:VUmEOh8FW/w2DaxFRH9SCrvIIF5j0dcEpxUy3Z7BtV4
debug1: Host 'ip' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\Micky/.ssh/known_hosts:4
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:B8BjflVLnBcR/eD2USLssP40zIZSbdj0o2Dl9aGFuOo C:\\Users\\Micky/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Micky/.ssh/id_ed25519
debug1: Next authentication method: password
debug1: read_passphrase: can't open /dev/tty: No such file or directory
git@ip's password:
Connection closed by ip port 22

[solution] find out our public key address through the log C:: <users/Micky \. SSH , and put the public key content on the SSH – keys setting on git platform

Pod lib Create ObjcName error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errn…

As we all know, pod lib create objcname

You need to clone the template from git: https://github.com/CocoaPods/pod-template.git

And then sometimes it’s very slow to report an error:

[!] /usr/bin/git clone https://github.com/CocoaPods/pod-template.git zplib

Cloning into 'zplib'...
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

Step one:

We need to know the meaning of the following code:

pod lib create ObjcName

In fact, it is equivalent to:

pod lib create ProjectName --template-url=https://github.com/CocoaPods/pod-template.git

Below is the moment to witness the miracle

1. Let’s go to Ma Yun or gitlab to upload and download the template https://github.com/CocoaPods/pod-template.git

2. Upload to your own warehouse: https://gitee.com/peter_ zhang/pod-template.git

3. Then the code can be changed to this:

pod lib create CuttingEnvironment --template-url=https://gitee.com/peter_zhang/pod-template.git

So OK, reduce the time of pod lib create and the tragedy of being blocked by the wall

Git Error: Github:remote: Invalid username or password……

LZ is currently in the whole remote warehouse. Submit using HTTPS, in Git bash through a series of commands

Remote: invalid username or password

fatal: Authentication failed for ‘ https://github.com/ …

Baidu has come up with a solution, saying that it can re execute git config command to configure user name and mailbox

gitconfig-–globaluser.name”xxx”

gitconfig–-globaluser.email” [email protected]

But it didn’t solve my problem. Later, after searching the answers of major netizens for several times, I found that it was my password setting error

After executing the command, GIT will pop up a GitHub login interface. After you log in successfully, you are required to enter your user name and password. The password here is not your GitHub password or local git password

is GitHub’s personal access tokens instead

After the password is filled in again. Perfect solution

From now on, as long as you submit locally, you can use the following command: git push origin master

Only by pushing the latest changes of the local master branch to GitHub can we have a real distributed version library

[Solved] Git push error. ! [rejected] master -> master (non-fast-forward)

Error prompt:

Cheetah@xxxx MINGW64 /e/Projs/enft/data/cv_key_frame (master)
$ git push
To github.com:AnthonyGIS/video_frame.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:AnthonyGIS/video_frame.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.

Cheetah@xxxx MINGW64 /e/Projs/enft/data/cv_key_frame (master)

The reason for the non fast forward problem is that there is already some code in Git repository, so it does not allow you to directly cover your code

method 1

Push, that is, use strong coverage to replace the content in Git warehouse with your local code

If the remote warehouse is just built and there is no code, or you are sure that the code in the remote warehouse is useless, you can operate in this way and try to avoid this operation method

git push -f

Method 2

First fetch git to your local area, then merge and then push

$ git fetch
$ git merge

If, when git merge occurs

fatal: refusing to merge unrelated histories

You can use, git pull origin master –allow-unrelated-histories, to take care of that.

Continue with git merge

If, in case of.

fatal: You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you merge.

is that we haven’t committed the current changes, git add . , git commit -am “commit message”, then git merge again, and ok.

Finally, git push.(git push origin master).

It prompts Already up-to-date, and the upload is done.