简体   繁体   中英

Git URL for a Bitbucket repo not showing

I have a strange thing going on. Someone gave me a repo on a linux box, when I do:

$ git status 
On branch master
nothing to commit, working directory clean

This means it is a Git repo, I tried to find the remote URL for this repo using:

$ git config --get remote.origin.url

It doesn't show me anything. Also if I do:

$ git remote show origin
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.

I believe the repo only created locally. Not linked with the remote.

Try run git remote -v it will give the details of remote. If it doesn't show you anything. That means the repo is not linked with the remote. If this is the case linked the remote with your local repo by running

git remote add origin <your_repo_url>

I believe that your public key has somehow become out of sync with the one you have installed on BitBucket. Try these steps:

From your Git bash locally, do

$ cat ~/.ssh/id_rsa.pub

This will output your public key to console. Keep the bash open, because you will need this key later on.

Next, go to the Bitbucket website and login. Click the person icon from the upper left side of BitBucket and choose "Bitbucket settings". Then, from the left side menu choose SECURITY <- SSH keys , and you should see something like this:

在此处输入图片说明

Click "Add key", which will generate a popup looking like this:

在此处输入图片说明

Give the key a name and paste the dump from your Git bash here. Make sure that the first line has the text ssh-rsa Your actual key should pasted on the second line.

Click "Add key."

The error message should go away. You can delete the old key(s) if you want, but you don't have to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM