cagatayodabasi
cagatayodabasi

Reputation: 762

Pushing changes to OpenShift

I'm following the tutorial below to push a change to my OpenShift application.

$ git clone <git_url> <directory_to_create>

# Within your project directory
# Commit your changes and push to OpenShift

$ git commit -a -m 'Some commit message'
$ git push

Instead of pushing changes to OpenShift, Git pushes to GitHub. How can I push the changes to OpenShift? Thank you in advance.

Upvotes: 3

Views: 2224

Answers (2)

Whymarrh
Whymarrh

Reputation: 13565

By default, a cloned repository has a single remote (named origin, the source that it was cloned from), and the master branch has that remote's master branch set as its upstream. You can see a list of remotes by running git remote -v and a list of what branches have their upstreams set by running git branch -vv. When you push and pull, you are interacting with the upstream branch.

If you want to change where you push and pull from, you can do one of:

  • Change the url of the origin remote (as per hexafraction's answer). This will override the GitHub URL with your new URL.
  • Add a new remote (git remote add openshift $url) and push to that remote explicitly via:

    git push openshift master
    

    This will NOT change the default upstream and git push alone will still push to origin.

  • Add a new remote (same as above) and set the upstream branch when pushing:

    git push -u openshift master
    

    This will set the upstream to openshift/master.

Upvotes: 4

nanofarad
nanofarad

Reputation: 41271

If you git clone'd from GitHub, your Git remote will be set to push back to GitHub. You can change this remote to point to OpenShift:

git remote set-url origin ssh://[email protected]/~/git/foo.git/

You can get this URL from the OpenShift website for the specific domain in question.

Upvotes: 4

Related Questions