码农知识堂 - 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操作才行。

  • 相关阅读:
    【C++】C++异常
    企业如何凭借软文投放实现营销目标?
    05-jQuery的ajax
    融合莱维飞行与黄金正弦的蚁狮优化算法-附代码
    从海后丢掉“海后”这个角色说起—— 论VOC对于DTC品牌的重要性
    C++ 继承
    算法每日一题(python,2024.05.27) day.9
    14:00面试,14:06就出来了,问的问题有点变态。。。
    【重学Reids 缓存】之Reids 缓存之RDB 持久化
    【BurpSuite】插件学习之Software Vulnerability Scanner
  • 原文地址:https://blog.csdn.net/zaza0_0/article/details/133754059
  • 最新文章
  • 沪漂五周年了:我越来越迷茫了
    Agentic Skill Routing 实战:别再把所有 Skill 塞进 AI Agent 上下文
    MySQL-Seconds_behind_master的精度误差
    [MAF预定义ChatClient中间件-03]CachingChatClient——利用缓存省钱省时间
    AI的至暗历史:从万众期待到被政府撤资,AI的两次死亡徘徊
    Agent OS :五种驯服不确定性的范式
    PortSwigger SQL注入LAB11
    数据库即时编译JIT
    [Begin]AI Learn Data Day 0
    深度学习进阶(二十七)现代 LLM 的核心架构设计其二:SwiGLU
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
小工具 小游戏
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1

京公网安备 11010502049817号