扫盲:在github上新建一个仓库并上传本地工程
我自己新建了个项目,一步一步流程如下。
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git init
初始化空的 Git 版本库于 /home/zhoudd/桌面/mini_embed_driver_framework/.git/
zhoudd@desay:~/桌面/mini_embed_driver_framework$ ssh-keygen -t rsa -C "zhoudd@desay.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/zhoudd/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/zhoudd/.ssh/id_rsa.
Your public key has been saved in /home/zhoudd/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:yrI0DlwlbAVXPYDVjOzr7u9nuuu+6wNSXaO3TD7OuNQ zhoudd@desay.com
The key's randomart image is:
+---[RSA 2048]----+
| ..o=+* |
| . o. o = o |
| + .. . + . |
| . o o o o |
| . .S. = . |
| . . ...o .= |
| o + oo ..+E. |
| + + ..o = |
| o oo*&@ |
+----[SHA256]-----+
zhoudd@desay:~/桌面/mini_embed_driver_framework$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.255.113)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.255.113' (RSA) to the list of known hosts.
Hi zhoudd1! You've successfully authenticated, but GitHub does not provide shell access.
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git config --global user.name "zhoudd"
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git config --global user.email "zhoudd@desay.com"
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git remote add origin git@github.com:zhoudd1/Embedded-Driver-Framework.git
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git add .
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git commit -m "Embedded Driver Framework v1.0.0"
[master (根提交) 849606c] Embedded Driver Framework v1.0.0
14 files changed, 628 insertions(+)
create mode 100644 bsp/driver/clk/clk.c
create mode 100644 bsp/driver/clk/clk.h
create mode 100644 bsp/driver/test/test.c
create mode 100644 bsp/driver/test/test.h
create mode 100644 bsp/driver/wdt/wdt.c
create mode 100644 bsp/driver/wdt/wdt.h
create mode 100644 bsp/soc/device.c
create mode 100644 bsp/soc/device.h
create mode 100644 bsp/soc/soc_config.c
create mode 100644 bsp/soc/soc_config.h
create mode 100644 project/driver_test.cbp
create mode 100644 project/driver_test.depend
create mode 100644 project/driver_test.layout
create mode 100644 project/main.c
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git push origin master
Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.
To git@github.com:zhoudd1/Embedded-Driver-Framework.git
! [rejected] master -> master (fetch first)
error: 无法推送一些引用到 'git@github.com:zhoudd1/Embedded-Driver-Framework.git'
提示:更新被拒绝,因为远程版本库包含您本地尚不存在的提交。这通常是因为另外
提示:一个版本库已向该引用进行了推送。再次推送前,您可能需要先整合远程变更
提示:(如 'git pull ...')。
提示:详见 'git push --help' 中的 'Note about fast-forwards' 小节。
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git push
fatal: 当前分支 master 没有对应的上游分支。
为推送当前分支并建立与远程上游的跟踪,使用
git push --set-upstream origin master
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git pull origin master
warning: no common commits
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
展开对象中: 100% (4/4), 完成.
来自 github.com:zhoudd1/Embedded-Driver-Framework
* branch master -> FETCH_HEAD
* [新分支] master -> origin/master
Merge made by the 'recursive' strategy.
.gitignore | 33 +++++++++++++++++++++++++++++++++
README.md | 2 ++
2 files changed, 35 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
zhoudd@desay:~/桌面/mini_embed_driver_framework$ git push origin master
对象计数中: 25, 完成.
Delta compression using up to 4 threads.
压缩对象中: 100% (25/25), 完成.
写入对象中: 100% (25/25), 5.50 KiB | 0 bytes/s, 完成.
Total 25 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), done.
To git@github.com:zhoudd1/Embedded-Driver-Framework.git
33e91b3..5e361ab master -> master
zhoudd@desay:~/桌面/mini_embed_driver_framework$
上传成功了,这是我上传的项目https://github.com/zhoudd1/driver
然后就可以
1、使用git clone https://github.com/zhoudd1/driver.git
2、编辑项目
3、git add your files/git add . (将改动添加到暂存区)
4、git commit -m "提交说明"
5、git push origin master 将本地更改推送到远程master分支。
这就完成了克隆、编辑、更新工程并向远程仓库的推送。
git init
ssh-keygen -t rsa -C "150********@163.com"
ssh -T git@github.com
git config --global user.name "zhoudd1"
git config --global user.email "150********@163.com"
git remote add origin git@github.com:zhoudd1/test.git
git add .
git commit -m "test"
git branch --set-upstream-to=origin/master master
git pull
git push origin master
附加:
4. 使用 git commit --amend 进行修改,完成后 :wq 退出
5. 使用 git rebase --continue 完成操作
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A simple command-line tutorial:
Git global settings:
git config --global user.name "zhoudd" git config --global user.email "150********@163.com"
Create git repository:
mkdir ffmpeg2
cd ffmpeg2
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/dong2/ffmpeg2.git
git push -u origin master
Existing repository?
cd existing_git_repo
git remote add origin https://gitee.com/dong2/ffmpeg2.git
git push -u origin master
--------------------------------------------------------------------------------------------------------------------------------------------
#The repository for this project is empty
You can create files directly in GitLab using one of the following options.
#Command line instructions
You can also upload existing files from your computer using the instructions below.
Git global setup
git config --global user.name "zhoudd"
git config --global user.email "zhoudd@qq.com"
#Create a new repository
git clone git@192.168.1.200:multimedia/gstreamer.git
cd gstreamer
touch README.md
git add README.md
git commit -m "add README"
git push -u origin master
#Push an existing folder
cd existing_folder
git init
git remote add origin git@192.168.1.200:multimedia/gstreamer.git
git add .
git commit -m "Initial commit"
git push -u origin master
#Push an existing Git repository
cd existing_repo
git remote rename origin old-origin
git remote add origin git@192.168.1.200:multimedia/gstreamer.git
git push -u origin --all
git push -u origin --tags