Brett
Brett

Reputation: 20049

Setting up BitBucket so you can use pull from it on your server

I have setup a repository and have it working locally so I can push/pull from BitBucket; now I am trying to get it working so I can do git pull from a my host server.

I have setup a SSH Key and that is all good and well, but when I do:

cat .git/config

All I get is:

[core]
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true

Whilst my config file on my local environment contains:

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
[remote "origin"]
    url = [email protected]:git-username/my-repo.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
    remote = origin
    merge = refs/heads/master
[gui]
    wmstate = normal
    geometry = 887x427+25+25 171 192

So not sure why they are so different? I assume I need to add a remote origin however I am unsure how to go about it? I assume you follow the same instructions you do when you are setting up a repository via BitBucket but I'm not sure if that is all? ....and can't seem to find that information again once the repo has been created.

Upvotes: 0

Views: 76

Answers (2)

Brett
Brett

Reputation: 20049

Ok, the below is what you will need to do to be able to pull from your server from your bitbucket repo:

  1. It is recommended you add a Deployment Key as per Lester Vargas's answer.
  2. From the command line run git remote add origin [email protected]:bb-username/repo-name.git

Now, to get the section [branch "master"] so that it automatically pulls from the master branch for the repo you can do the below on the command line:

  1. git config branch.master.remote origin
  2. git config branch.master.merge refs/heads/master

That should do it!

Upvotes: 1

Lester Vargas
Lester Vargas

Reputation: 368

If you want to pull your repo from your server, you need to put a DEPLOYMENT KEY, which you can get going to your repo > setting > depolyments keys.

Then get the rsa key from your server and put it there.

The SSH key is to connect your computer with your server or with bitbucket, but not between your server and bitbucket, just remember that.

If you need something else just ask :)

Upvotes: 0

Related Questions