07-23-2022 08:05 PM
Hi,
I have set up GitLab remote repository and use Fork as my git client; which I have managed to get working. but every time I push to the remote repo it prompts for username & password. I tried one common solution of saving the SSH key on GitLab which was generated in Fork. But it doesn't work.
I guess I have to add the GitLab account to Fork. I have generated the personal access token from GitLab correctly, but it throws an authentication failure error (Please see screenshot below)
I even tried with another client - SourceTree. It doesn't allow me to add the account either. I have followed the step by step guide here How to Access GitLab via SourceTree (UPDATED) - A Word From Net. Still at the place where I enter credentials, it throws an error stating authentication failure.
I'd appreciate if someone can advise.
Solved! Go to Solution.
07-25-2022 01:57 AM
Are you able to 'fetch' from GitLab without error? If only the push operation is unsuccessful, you may wish to check the git remote URL settings. From a command line (PowerShell or Command, it doesn't matter as long as you have Git installed), in the repo folder, enter:
git remote -v
The command output should be something like:
origin git@gitlab.com:indriyani/mygitlabproject.git (fetch)
origin git@gitlab.com:indriyani/mygitlabproject.git (push)
Note that both (fetch) and (push) URLs are the same. In my case, I used SSH above (URLs begin with git@gitlab.com). The SSH approach does not require the use of Personal Access Tokens, just the proper registration of the public key in your GitLab SSH settings. On the other hand, if you are using HTTPS URLs, then the SSH keys won't matter. In that latter case, your personal access tokens would come into play.
07-25-2022 09:45 AM
I've seen issues using the built-in SSH generation in Fork and Sourcetree. For some reason these have been inconsistent. I use the manual method of creating the key pair and adding the public key to Gitlab and have had no further issues. I personally use the git-bash terminal emulator for all of this.
https://docs.gitlab.com/ee/user/ssh.html
I also second Dhakkan in checking that the remote URL is formatted correctly for both fetch and pull.
07-25-2022 09:50 AM
@r_good wrote:I've seen issues using the built-in SSH generation in Fork and Sourcetree. For some reason these have been inconsistent. I use the manual method of creating the key pair and adding the public key to Gitlab and have had no further issues. I personally use the git-bash terminal emulator for all of this.
https://docs.gitlab.com/ee/user/ssh.html
I also second Dhakkan in checking that the remote URL is formatted correctly for both fetch and pull.
Just follow the directions from Gitlab and use Git Bash. Haven't had any issues with that.