views:

38

answers:

3

I cloned a repo using its GitHub read-only URL onto my team's staging server. I made some changes there to the config files.

I'd like to change the repo clone on the server to be read-write, so that I can 'git push' the config file changes.

How do I do this?

Or is there a better 'best practice' way to deal with this scenario than committing from the staging server?

A: 

I'd take a diff from the staging server and apply it in a development environment via patch(1).

DDaviesBrackett
+2  A: 

open up .git/config in your favorite text editor and change the remote url to the read+write url that github shows you.

jshen
This is the canonical solution. If you're sure you want your stage server to have push access to the github repo, you probably want to do this. It's a very simple change.
jeremiahd
A: 

From GitHub Working with remote help page:

Changing a remote’s URL

There is no direct command to change a remote’s URL, so you will usually run git remote rm followed by git remote add to change a URL.
You can also edit the repo’s .git/config file directly to change the URL without re-fetching the remote.

I would recommend (see this SO question):

git remote set-url origin git://new.url.here

Using git command is always preferable to modifying directly a git config file manually.

VonC
It's not preferable to me because it's more junk I have to remember (unnecessarily) and is less direct.
jshen