码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • 【Github】将本地仓库同步到github上


    许久没有用GitHub了,怎么传仓库都忘记了。在这里记录一下
    If you have a local folder on your machine and you want to transform it into a GitHub repository, follow the steps below:

    1. Install Git (if not already installed)

    Make sure you have Git installed on your machine. If not, download and install Git.

    2. Create a GitHub Repository

    Before pushing your local folder to GitHub, create a repository on GitHub:

    • Go to GitHub.
    • Log in to your account.
    • Click on the + sign at the top right and choose “New repository.”
    • Fill in your repository name and choose other settings like whether you want to initialize it with a README (for this tutorial, do not initialize with README, .gitignore, or license).
    • Click “Create repository.”

    3. Initialize and Connect your Local Folder to the Repository

    Now, navigate to your local folder using the command line (Terminal for macOS/Linux, Command Prompt or Git Bash for Windows) and execute the following commands:

    # Navigate to your folder
    cd path/to/your/folder
    
    # Initialize the folder as a Git repository
    git init
    
    # Connect your local repository to your GitHub repository
    git remote add origin https://github.com/your-username/your-repository-name.git
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    Make sure to replace your-username with your actual GitHub username and your-repository-name with the name of the repository you just created.

    4. Push your Local Files to GitHub

    Now, you’ll commit your local files and push them to GitHub:

    # Add all files in the local directory to Git's staging area
    git add .
    
    # Commit the changes
    git commit -m "Initial commit"
    
    # Push the commit to the GitHub repository
    git push -u origin master
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    (Note: If the default branch name is different than master, for instance main, replace master with the appropriate branch name in the git push command.)

    After these steps, your local folder’s contents will now be in your GitHub repository!

    总之就是即使有github desktop,也还是需要git bash操作才行。

  • 相关阅读:
    网页url完整请求流程介绍
    相对于java,C++中的那些神奇语法
    【观察】天翼云政务大模型“慧泽”:推动政务服务再升级,加速智慧城市再进化...
    PIE-Engine 教程:水稻面积提取1(宿迁市)
    在本地Linux环境中安装lmmich并异地远程上传和管理照片
    接口响应慢该如何排查
    ESP32C3基于Arduino框架下的 ESP32 RainMaker开发示例教程
    java基础
    模拟滴答声
    贪心算法(又叫贪婪算法)Greedy Algorithm
  • 原文地址:https://blog.csdn.net/zaza0_0/article/details/133754059
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号