如何将我的 python spyder 与 github 连接?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42239874/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 21:27:40  来源:igfitidea点击:

How do I connect my python spyder with github?

pythongithubspyder

提问by ritos

Is there any way to connect python spyder with github?

有没有办法将python spyder与github连接?

I manage my R scripts via github, because R provides with interfaces that enables users to commit, pull and push, but I wonder if there is same(or similar) system in python(x,y) spyder.

我通过 github 管理我的 R 脚本,因为 R 提供了允许用户提交、拉取和推送的接口,但我想知道 python(x,y) spyder 中是否有相同(或类似)的系统。

I want to manage my python scripts with github, not just locally editing my codes and manually write change logs on my hand every time...

我想用github管理我的python脚本,而不仅仅是在本地编辑我的代码并每次手动在我手上写更改日志......

回答by Carlos Cordoba

(Spyder developer here) I'm sorry but right now (February 2017) there's no integration between Spyder and Git/Github.

这里Spyder 开发人员)很抱歉,但现在(2017 年 2 月)Spyder 和 Git/Github 之间没有集成。

Besides, there are no concrete plans to add this support. We could it in a year or year and a half.

此外,没有具体的计划来增加这种支持。我们可以在一年或一年半内完成。

Related issue on github: https://github.com/spyder-ide/spyder/issues/816

github上的相关问题:https: //github.com/spyder-ide/spyder/issues/816

回答by betontalpfa

A command line git has been integrated into Spyder.

命令行 git 已集成到 Spyder 中。

https://github.com/spyder-ide/spyder/issues/6105

https://github.com/spyder-ide/spyder/issues/6105

First right click the tab corresponding to any file in your repository and click "set console working directory."

Then go to the Ipython window in Spyder and simply type your git commands (assuming Git is installed and its paths are configured properly) but append a "!" to the beginning of your command:

!git add "file.py"
!git commit -m "My commit"
!git push origin master

首先右键单击存储库中任何文件对应的选项卡,然后单击“设置控制台工作目录”。

然后转到 Spyder 中的 Ipython 窗口并简单地输入您的 git 命令(假设 Git 已安装并且其路径配置正确)但附加一个“!” 到你的命令的开头:

!git add "file.py"
!git commit -m "My commit"
!git push origin master

回答by behold

+1 @betontalpfa. For me, I wanted to put a local file to an existing Github.com repository through Spyder ipython console.

+1 @betontalpfa。对我来说,我想通过 Spyder ipython 控制台将本地文件放到现有的 Github.com 存储库中。

So, instead of clicking "set console working directory", I just did the following in ipython console within Spyder( I'm on Mac OSX Mojave, and have installed Xcode already from Appstore):

因此,我没有单击“设置控制台工作目录”,而是在 Spyder 中的 ipython 控制台中执行以下操作(我使用的是 Mac OSX Mojave,并且已经从 Appstore 安装了 Xcode):

Init working directory as a git directory

将工作目录初始化为 git 目录

!git init

!git 初始化

pull existing repository to merge with files you want to push

拉现有存储库以与要推送的文件合并

!git remote add origin https://github.com/myUserName/sample.git

!git 远程添加源https://github.com/myUserName/sample.git

Add the file to local git

将文件添加到本地git

!git add temp.py

!git 添加 temp.py

Push the file to github.com

将文件推送到 github.com

!git push -u origin master

!git push -u origin master