2025年git上传项目到github

git上传项目到githubgit 上传项目到 github 用 Eclipse 建了 git 项目后 通过 git bash 上传项目到 github 当然前提远程库是存在的 1 生成公钥 ssh keygen t rsa C 2 将公钥 即 ssh id rsa pub

大家好,我是讯享网,很高兴认识大家。

git上传项目到github

用Eclipse建了git项目后,通过git bash上传项目到github,当然前提远程库是存在的。

1.生成公钥

·ssh-keygen -t rsa -C ""

2.将公钥(即~/.ssh/id_rsa.pub)然后放到github上

在账户中设置
这里写图片描述
讯享网
新建ssh keys
这里写图片描述

3.连接测试

ssh -T
注意参数大写T,正确输出Hi bottomheater/tudu_list! You've successfully authenticated, but GitHub does not provide shell access.
小写t会输出PTY allocation request failed on channel 0,坑

同时github上也会(钥匙图案绿了)
这里写图片描述这里写图片描述

也可以将公钥只部署到项目中
这里写图片描述

4.本地库关联到远程库

git remote add tudu :bottomheater/tudu.git

5.查看本地未提交的文件

git status

如果本地库有文件未提交,又暂时不想提交到远程库中,保存修改到stash

git stash

6.假如远程库有文件,先合并到本地库中

git pull --rebase tudu master

7.上传项目

git push -u tudu master

8.恢复本地未提交的已修改文件

git stash pop

附上完整过程

wang@Bottom MINGW32 ~/tudu (master) $ ssh -T  Warning: Permanently added the RSA host key for IP address '[192.30.253.122]:443' to the list of known hosts. Hi bottomheater! You've successfully authenticated, but GitHub does not provide shell access. wang@Bottom MINGW32 ~/tudu (master) $ git remote add tudu :bottomheater/tudu.git wang@Bottom MINGW32 ~/tudu (master) $ git stash No local changes to save wang@Bottom MINGW32 ~/tudu (master) $ git pull --rebase tudu master  From github.com:bottomheater/tudu * branch master -> FETCH_HEAD * [new branch] master -> tudu/master First, rewinding head to replay your work on top of it... Applying: [initial]Base on tudu list 2.3 Applying: [initial]add the file forgotten to upload. Applying: [modify]add chinese wang@Bottom MINGW32 ~/tudu (master) $ git push -u tudu master Counting objects: 645, done. Delta compression using up to 2 threads. Compressing objects: 100% (411/411), done. Writing objects: 100% (645/645), 2.75 MiB | 138.00 KiB/s, done. Total 645 (delta 135), reused 639 (delta 132) remote: Resolving deltas: 100% (135/135), completed with 1 local object. To :bottomheater/tudu.git ec9c4ed.. master -> master Branch master set up to track remote branch master from tudu. wang@Bottom MINGW32 ~/tudu (master) $ git stash pop On branch master Your branch is up-to-date with 'tudu/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: tudu/pom.xml modified: tudu/tudu-presentation/tudu-dwr/src/main/webapp/WEB-INF/web.xml Untracked files: (use "git add <file>..." to include in what will be committed) tudu/.classpath tudu/.project tudu/.settings/ tudu/target/ tudu/tudu-core/.classpath tudu/tudu-core/.gitignore tudu/tudu-core/.project tudu/tudu-core/.settings/ tudu/tudu-core/.springBeans tudu/tudu-core/ajcore...567.txt tudu/tudu-core/ajcore...773.txt tudu/tudu-core/ajcore...793.txt tudu/tudu-core/ajcore...159.txt tudu/tudu-core/ajcore...179.txt tudu/tudu-core/ajcore...267.txt tudu/tudu-presentation/.project tudu/tudu-presentation/.settings/ tudu/tudu-presentation/tudu-dwr/.classpath tudu/tudu-presentation/tudu-dwr/.project tudu/tudu-presentation/tudu-dwr/.settings/ tudu/tudu-presentation/tudu-dwr/.springBeans tudu/tudu-presentation/tudu-dwr/src/main/code/ tudu/tudu-presentation/tudu-dwr/src/main/webapp/WEB-INF/jsp/test.jsp tudu/tudu-presentation/tudu-dwr/src/main/webapp/WEB-INF/spring/springmvc-controller.xml tudu/tudu-presentation/tudu-dwr/target/ tudu/tudu-presentation/tudu-flex/.classpath tudu/tudu-presentation/tudu-flex/.project tudu/tudu-presentation/tudu-flex/.settings/ tudu/tudu-presentation/tudu-flex/target/ tudu/tudu-presentation/tudu-gwt/.classpath tudu/tudu-presentation/tudu-gwt/.project tudu/tudu-presentation/tudu-gwt/.settings/ tudu/tudu-presentation/tudu-gwt/.springBeans tudu/tudu-presentation/tudu-gwt/target/ tudu/tudu-presentation/tudu-jsf/.classpath tudu/tudu-presentation/tudu-jsf/.gitignore tudu/tudu-presentation/tudu-jsf/.project tudu/tudu-presentation/tudu-jsf/.settings/ tudu/tudu-presentation/tudu-portlet/.classpath tudu/tudu-presentation/tudu-portlet/.project tudu/tudu-presentation/tudu-portlet/.settings/ tudu/tudu-presentation/tudu-portlet/target/ tudu/tudu-presentation/tudu-springmvc/.classpath tudu/tudu-presentation/tudu-springmvc/.project tudu/tudu-presentation/tudu-springmvc/.settings/ tudu/tudu-presentation/tudu-springmvc/target/ tudu/tudu-presentation/tudu-springwebflow/.classpath tudu/tudu-presentation/tudu-springwebflow/.project tudu/tudu-presentation/tudu-springwebflow/.settings/ tudu/tudu-presentation/tudu-springwebflow/target/ tudu/tudu-ws/.project tudu/tudu-ws/.settings/ tudu/tudu-ws/tudu-axis-client/.classpath tudu/tudu-ws/tudu-axis-client/.gitignore tudu/tudu-ws/tudu-axis-client/.project tudu/tudu-ws/tudu-axis-client/.settings/ tudu/tudu-ws/tudu-axis/.classpath tudu/tudu-ws/tudu-axis/.gitignore tudu/tudu-ws/tudu-axis/.project tudu/tudu-ws/tudu-axis/.settings/ tudu/tudu-ws/tudu-xfire-jaxws2/.classpath tudu/tudu-ws/tudu-xfire-jaxws2/.project tudu/tudu-ws/tudu-xfire-jaxws2/.settings/ tudu/tudu-ws/tudu-xfire/.classpath tudu/tudu-ws/tudu-xfire/.gitignore tudu/tudu-ws/tudu-xfire/.project tudu/tudu-ws/tudu-xfire/.settings/ no changes added to commit (use "git add" and/or "git commit -a") Dropped refs/stash@{ 
  
    
  0} (2d0a0bfaad427bc60ce40ded70) wang@Bottom MINGW32 ~/tudu (master) $ git status On branch master Your branch is up-to-date with 'tudu/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: tudu/pom.xml modified: tudu/tudu-presentation/tudu-dwr/src/main/webapp/WEB-INF/web.xml Untracked files: (use "git add <file>..." to include in what will be committed) tudu/.classpath tudu/.project tudu/.settings/ tudu/target/ tudu/tudu-core/.classpath tudu/tudu-core/.gitignore tudu/tudu-core/.project tudu/tudu-core/.settings/ tudu/tudu-core/.springBeans tudu/tudu-core/ajcore...567.txt tudu/tudu-core/ajcore...773.txt tudu/tudu-core/ajcore...793.txt tudu/tudu-core/ajcore...159.txt tudu/tudu-core/ajcore...179.txt tudu/tudu-core/ajcore...267.txt tudu/tudu-presentation/.project tudu/tudu-presentation/.settings/ tudu/tudu-presentation/tudu-dwr/.classpath tudu/tudu-presentation/tudu-dwr/.project tudu/tudu-presentation/tudu-dwr/.settings/ tudu/tudu-presentation/tudu-dwr/.springBeans tudu/tudu-presentation/tudu-dwr/src/main/code/ tudu/tudu-presentation/tudu-dwr/src/main/webapp/WEB-INF/jsp/test.jsp tudu/tudu-presentation/tudu-dwr/src/main/webapp/WEB-INF/spring/springmvc-controller.xml tudu/tudu-presentation/tudu-dwr/target/ tudu/tudu-presentation/tudu-flex/.classpath tudu/tudu-presentation/tudu-flex/.project tudu/tudu-presentation/tudu-flex/.settings/ tudu/tudu-presentation/tudu-flex/target/ tudu/tudu-presentation/tudu-gwt/.classpath tudu/tudu-presentation/tudu-gwt/.project tudu/tudu-presentation/tudu-gwt/.settings/ tudu/tudu-presentation/tudu-gwt/.springBeans tudu/tudu-presentation/tudu-gwt/target/ tudu/tudu-presentation/tudu-jsf/.classpath tudu/tudu-presentation/tudu-jsf/.gitignore tudu/tudu-presentation/tudu-jsf/.project tudu/tudu-presentation/tudu-jsf/.settings/ tudu/tudu-presentation/tudu-portlet/.classpath tudu/tudu-presentation/tudu-portlet/.project tudu/tudu-presentation/tudu-portlet/.settings/ tudu/tudu-presentation/tudu-portlet/target/ tudu/tudu-presentation/tudu-springmvc/.classpath tudu/tudu-presentation/tudu-springmvc/.project tudu/tudu-presentation/tudu-springmvc/.settings/ tudu/tudu-presentation/tudu-springmvc/target/ tudu/tudu-presentation/tudu-springwebflow/.classpath tudu/tudu-presentation/tudu-springwebflow/.project tudu/tudu-presentation/tudu-springwebflow/.settings/ tudu/tudu-presentation/tudu-springwebflow/target/ tudu/tudu-ws/.project tudu/tudu-ws/.settings/ tudu/tudu-ws/tudu-axis-client/.classpath tudu/tudu-ws/tudu-axis-client/.gitignore tudu/tudu-ws/tudu-axis-client/.project tudu/tudu-ws/tudu-axis-client/.settings/ tudu/tudu-ws/tudu-axis/.classpath tudu/tudu-ws/tudu-axis/.gitignore tudu/tudu-ws/tudu-axis/.project tudu/tudu-ws/tudu-axis/.settings/ tudu/tudu-ws/tudu-xfire-jaxws2/.classpath tudu/tudu-ws/tudu-xfire-jaxws2/.project tudu/tudu-ws/tudu-xfire-jaxws2/.settings/ tudu/tudu-ws/tudu-xfire/.classpath tudu/tudu-ws/tudu-xfire/.gitignore tudu/tudu-ws/tudu-xfire/.project tudu/tudu-ws/tudu-xfire/.settings/ no changes added to commit (use "git add" and/or "git commit -a") wang@Bottom MINGW32 ~/tudu (master) $

讯享网
小讯
上一篇 2025-03-02 10:56
下一篇 2025-02-19 14:38

相关推荐

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/126609.html