gpt4 book ai didi

git - 将 GitHub 存储库移至 Raspberry Pi 上的私有(private)存储库

转载 作者:行者123 更新时间:2023-12-02 14:23:11 24 4
gpt4 key购买 nike

我最近买了一个树莓派。我在 Raspberry Pi 上完成了 SSH 和 Git 的安装和设置。我可以使用 ssh 建立连接和传输文件和 scp分别。

我正在使用 16 GB USB 驱动器来存储安装在 /media/data 上的数据.

我在 GitHub 上有几个存储库。我想将这些存储库迁移到我的 Raspberry Pi,这样每次我使用 git push ,所有提交都推送到我的树莓派。

例如,我在 GitHub 上拥有这个存储库:

https://github.com/cfbaptista/PolyMath.jl

我通过运行从我的笔记本电脑推送到这个存储库:

$ cd /home/carlos/Workspace/PolyMath.jl/
$ git push

但是,我不想推送到 GitHub,而是想推送到:
raspberrypi:/media/data/repos/git/PolyMath.jl

如何执行必要的更改?

P.S.:暂时,我的 Raspberry Pi 只能在我自己的本地网络上访问。外部访问尚未设置。

最佳答案

您需要添加一个指向 Raspberry Pi 上新存储库的新 Remote ,请参阅 adding remotes 上的这篇文章.

例如。

git remote add pi **url-to_new-repo**
git push pi master

第一个命令设置一个新的远程 pi ,而第二个 push 你的 master分支到 pi .

如果您想让分支自动推送到远程,您可以将其设置为远程跟踪分支。有关更多详细信息,请参阅此问题:

How do I change the remote a git branch is tracking?

关于git - 将 GitHub 存储库移至 Raspberry Pi 上的私有(private)存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20835190/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com