简体   繁体   中英

How to 'git push' to a repo that was cloned as read-only onto my team's staging server

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?

在您喜欢的文本编辑器中打开.git / config并将远程URL更改为github向您显示的读取+写入URL。

如果您只想设置推送网址,则可以使用--push选项

git remote set-url --push origin git@github.com:leo/repox.git

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.

我将从登台服务器获取差异并通过patch(1)将其应用于开发环境中。

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