- Unable to clone a remote repository via its HTTPS URL
- I am asked for my password every time I push to/pull from the remote repository
Error "Permission denied (publickey)" when connecting to a remote repository using SSH
First of all, you will want to ensure the following:
- Is the URL correct?
- Is the secret key correctly configured in the local machine?
- Is the public key correctly configured in the remote?
You can verify the public/secret key configuration corresponding to the Backlog remote repository by running the following command:
$ ssh <space>@<space>.git.backlogtool.com
Replace <space> with a Backlog space that you own (eg. for the space 'demo.backlogtool.com', it will be 'firstname.lastname@example.org')
If the setting is correct, you will see the following output. If you see an error message, repeat the steps above and ensure you are doing it right.
Hi yourname! You've successfully authenticated, but Backlog does not provide
Connection to git.backlogtool.com closed.
Unable to clone a remote repository via its HTTPS URL
On older versions of Git, you may occassionally face problems when executing a push or pull. It is recommended that you use Git version 1.7.10 or later. If you are using a Git client such as Source Tree or TortoiseGit, use the Git version that comes along with the corresponding client.
I am asked for my password every time I push to/pull from the remote repository
On Git version 1.7.10 or later, you can avoid entering password multiple times by configuring as follows.
You can use git-credential-winstore, which will only ask for your password the first time you push/pull.
You can use SourceTree (which we covered in the earlier chapter) to link with the Mac Keychain. This will allow Git to figure out which credentials to use every time you pull or push.
On a Mac, you can use the Git's credentials API to link a username/password with Git operations. If you use Homebrew, the Git credential API is intalled automatically. Otherwise, you will have to install it manually.
You can check if the credential API is installed with the command below.
$ git credential-osxkeychain
Usage: git credential-osxkeychain <get|store|erase>
If the credential API is not installed, you will see the output below.
$ git credential-osxkeychain
git: 'credential-osxkeychain' is not a git command. See 'git --help'.
In that case, you can download it and move the files to /usr/local/bin
$ curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
$ chmod u+x git-credential-osxkeychain
$ mv git-credential-osxkeychain /usr/local/bin
Upon completing installation, run the following command below to activate the credential API.
git config --global credential.helper osxkeychain
Changes pushed to the remote repository are not being reflected there
You may come across the following message below when executing a push. That would normally happen when you are pushing from a new local repository.
$ git push
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
By omitting the branch name when executing a push, Git will by default assume that you are trying to push the current change to a remote branch with the same name as the local branch. This happens if the master branch has not been created in the remote repository yet (we are pushing from the local master branch). In this case, we will have to explicitly assign the branch name when executing a push.
$ git push -u origin master
By doing that, the master branch will be created in the remote repository automatically. The next time you run push, you can omit the branch name.