window上传本地源码到GitHub的repository

本文提供了两种在GitHub上上传源码的方法:一是通过GitHub网站直接上传;二是利用命令行工具gitbash进行操作。文章详细介绍了如何使用gitbash完成源码的上传,并给出了Windows环境下具体的步骤及注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

昨晚脑子进水,在优快云论坛啊,百度上之类上面找了一堆没用的东西,整了半天也没把源码上传上去。刚刚Google上面搜了一下,10分钟就搞定了。
地址:https://help.github.com/articles/adding-a-file-to-a-repository-using-the-command-line/
这个网页里面还有Mac和Linux的版本。
(鉴于有的被墙了可能进不去)这里简单给出windows的操作:
主要有两种方式:
第一、通过GitHub的网站(详细步骤
(登陆自己主页)上传现有的文件。upload拖动,但是不知道什么原因,我的每次提交之后就白屏了,一直upload不上去。
第二、通过命令行模式;(详细步骤
通过命令行需要下载一个git bash小工具;
This procedure assumes you’ve already:
(我下面提供了一张图)
主要流程包括在git bash的输入命令都有:
简单说:

1、在Git Bash里面cd到你存放GitHub项目文件夹【我的在/document/GitHub】,cd到你想要上传的整个项目【poseestimation】;
2、把你的GitHub里面空的repository下载下来,我的是【Visual-SLAM】;
3、【Visual-SLAM】不管是download的还是git clone的放到GitHub中;
4、把我要上传到【Visual-SLAM】 的项目【poseestimation】拷贝到[GitHub/Visual-SLAM]
4、接着就是一步步的进行。
这里写图片描述

Warning: Never git add, commit, or push sensitive information to a remote repository. Sensitive information can include, but is not limited to:

Passwords
SSH keys
AWS access keys
API keys
Credit card numbers
PIN numbers
For more information, see "Removing sensitive data from a repository."

1、On your computer, move the file you’d like to upload to GitHub into the local directory that was created when you cloned the repository.
2、Open Git Bash.

3、Change the current working directory to your local repository.

4、Stage the file for commit to your local repository.

$ git add .
# Adds the file to your local repository and stages it for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.

5、Commit the file that you’ve staged in your local repository.

$ git commit -m "Add existing file"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.

6、Push the changes in your local repository to GitHub.

$ git push origin your-branch
# Pushes the changes in your local repository up to the remote repository you specified as the origin

删除仓库里面的部分文件夹:

1.克隆远程仓库到本地库。例如使用ssh方法:git clone git@github.com:xxx/xxx.git

2.对需要删除的文件、文件夹进行如下操作:
git rm test.txt (删除文件)
git rm -r test (删除文件夹)

3.提交修改
git commit -m “Delete some files.”

4.将修改提交到远程仓库的xxx分支:

git push origin xxx

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值