0

I am using gitlab to manage my code.

When I manage my code with git bash, it could commit and push the code to the server successfully.

The code I use in the git bash like this:

git add .
git commit
git push -u origin master

However, when I commit the project in Qt creator, the author information do not fill automatically.

( click here for the capture image 1)

What's more, I click push in the git option in Qt creator. such as:

(click here for the capture image 2)

it failed to send the code to the server, and here is the error message:

14:20 Executing in H:\0000ybzhao\Programming\00.git\pairSam2Bed: C:\Program Files\Git\bin\git.exe push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

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

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

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)

Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
The command "C:\Program Files\Git\bin\git.exe" terminated with exit code 128.

Is there anyone who knows why this happen or how to solve this problem?

Thanks in advance.

ybzhao
  • 69
  • 9

2 Answers2

1

Use in terminal

git push --set-upstream origin master

after it your Qt will be well.

ilia plat
  • 21
  • 2
0

You probably need to initialize git on your computer with a username and an email address.

https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

Other comments on using Git in Windows

And I would look at installing and using SourceTree by Atlassian. It really makes managing git repos easy and visual. And another neat tool for windows is p4merge, that can be used to do merge and conflict resolutions on a git repository.

Easiest way to install these tools on Windows:

  1. Install Chocolatey in an admin command prompt.
  2. Run choco install P4Merge SourceTree -y in an admin command prompt.
  3. Open up source tree, follow the prompts (skip stuff for Mercurial).
  4. Add P4Merge as an external merge tool in options.

Hope that helps.

phyatt
  • 18,472
  • 5
  • 61
  • 80
  • Thanks for your response. Actually, I have initialized the git with username and email.on my computer. and I found that the most reason is "Host key verification failed.fatal: Could not read from remote repository." and I will go on try your append response. – ybzhao Sep 04 '15 at 19:35
  • Depending on the host, you need to create a public key and install it on your computer, or remove an old host key. SourceTree makes this pretty painless. http://doc.gitlab.com/ce/ssh/README.html How to remove an old host key http://stackoverflow.com/questions/13363553/git-error-host-key-verification-failed-when-connecting-to-remote-repository – phyatt Sep 04 '15 at 20:38