I have a repo at Gitlab, started in W10. I pushed it.
I cloned it into a Linux OS and started doing things. I created a new branch, call it "mybranch". I pushed it. It's there, in Gitlab.
During these various ops in Linux I also established an SSH key so I wouldn't have to constantly enter my user name and password. This might be relevant... NB back in W10 I don't have to enter the user name + pwd either... but I think I set that up some other way than an SSH key.
I've just gone back to W10 and have gone git pull
. git branch -a
does not show "mybranch".
So I looked at various similar questions:
I first went git fetch --all
. After this:
git remote update
does not solve the problem (shows only "master")git pull --all
does not solve the problem, I get:"Your configuration specifies to merge with the ref 'refs/heads/master' from the remote, but no such ref was fetched."
git remote show origin
gives a response I don't understand:"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."
Then, trying to follow this, I added the following 2 lines to the "config" file of my local git repo:
[remote]
fetch = +refs/heads/*:refs/remotes/origin/*
Then I tried the things above again and got exactly the same answers. git branch -a
only ever shows "master".
Possibly I need to edit the "config" file in my Gitlab (remote) repo rather than the local one. But I couldn't find it in Gitlab.
So I'm floundering. Maybe I've configured something badly! I have no idea.
Attempt to clone
Interesting. I find I can't clone either in W10 (i.e. in a fresh directory):
...>git clone git@gitlab.com:mikerodent/myproject.git
Cloning into 'myproject'...
The authenticity of host 'gitlab.com (172.65.251.78)' can't be established.
ED25519 key fingerprint is SHA256:eUX...........
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitlab.com' (ED25519) to the list of known hosts.
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Further actions after suggestions by torek
I deleted the two lines in the file "config"
I added a new SSH key to Gitlab using the procedure which worked in Linux
I made the connection between my machine & the remote:
(myproject) D:\My documents\myproject>git remote set-url origin ssh://git@gitlab.com/mikerodent/myproject
error: No such remote 'origin' # failed
(myproject) D:\My documents\myproject>git remote add origin https://gitlab.com/mikerodent/myproject.git
(myproject) D:\My documents\myproject>git remote set-url origin ssh://git@gitlab.com/mikerodent/myproject # no error reported
NB a curious point is that it wouldn't let me choose a normal W10 path to store my SSH key file: in the end I had to choose the default "/home/mrodent/.ssh" (i.e. Linux-style path). I don't know what this means: I'm using a W10 terminal.
Unfortunately this didn't resolve the issue. However the above did seemingly modify the config file (local repo) as required: I now find it is as follows:
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
[branch "master"]
remote = https://gitlab.com/mikerodent/myproject.git
merge = refs/heads/master
[remote "origin"]
url = ssh://git@gitlab.com/mikerodent/myproject
fetch = +refs/heads/*:refs/remotes/origin/*
Similar fails to previously:
(myproject) D:\My documents\myproject>git fetch --all
Fetching origin
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch origin
(myproject) D:\My documents\myproject>git pull --all
Fetching origin
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
error: Could not fetch origin
(myproject) D:\My documents\myproject>git remote show origin
git@gitlab.com: Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
(myproject) D:\My documents\myproject>git remote add origin git@gitlab.com:mikerodent/myproject.git
error: remote origin already exists.
(myproject) D:\My documents\myproject>git branch -a
* master
I note that it says "could not fetch origin" at the same time as saying "remote origin already exists". It appears this may be a permission problem...
If anyone can recommend where I might read up on the issues which might be involved there that'd be good. I have no idea what's going on.
joanis: Output from git remote -v
(myproject) D:\My documents\myproject>git remote -v
origin ssh://git@gitlab.com/mikerodent/myproject (fetch)
origin ssh://git@gitlab.com/mikerodent/myproject (push)
Yes, I can clone using git clone https...
. All expected branches are there.