作者:勇气的爱_961 | 来源:互联网 | 2023-06-22 16:09
昨晚脑子进水,在CSDN论坛啊,百度上之类上面找了一堆没用的东西,整了半天也没把源码上传上去。刚刚Google上面搜了一下,10分钟就搞定了。地址:https:help.gith
昨晚脑子进水,在CSDN论坛啊,百度上之类上面找了一堆没用的东西,整了半天也没把源码上传上去。刚刚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、接着就是一步步的进行。
![这里写图片描述](https://www.#.com/go/aHR0cDovL2ltZy5ibG9nLmNzZG4ubmV0LzIwMTcwNTI2MTQ0MjAyODgyP3dhdGVybWFyay8yL3RleHQvYUhSMGNEb3ZMMkpzYjJjdVkzTmtiaTV1WlhRdmNYRmZNams0TWpnMk1qTT0vZm9udC81YTZMNUwyVC9mb250c2l6ZS80MDAvZmlsbC9JMEpCUWtGQ01BPT0vZGlzc29sdmUvNzAvZ3Jhdml0eS9Tb3V0aEVhc3Q=)
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