使用Git上传本地项目到oschina

1.首先看一下本身是否有公钥, 在 个人资料-->SSH公钥  查看,若是没有,添加本身的SSH 公钥:git

SSH key 能够让你在你的电脑和 Git @ OSC 之间创建安全的加密链接。安全

你能够按以下命令来生成sshkeyssh

ssh-keygen -t rsa -C "xxxxx@xxxxx.com"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...

查看你的public key,并把他添加到 Git @ OSC http://git.oschina.net/keyside

cat ~/.ssh/id_rsa.pub
# ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....

复制加密

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....

添加到公钥里面,保存。名称本身定。.net

添加后,在终端(Terminal)中输入code

ssh -T git@git.oschina.net

若返回it

Welcome to Git@OSC, yourname!

则证实添加成功。ast

2.打开Git  Bash,将目录切换到你的项目所在的文件夹email

例如你有一个项目Demo,你就切换到.../Demo目录下

3.运行命令 git init .   注意后面有一个点

4.运行命令 git pull git@git.oschina.net:xxxx/Demo.git 

5.运行命令  git add -A .  注意后面有一个点

6.运行命令  git commit -am "对代码的有关说明"

7.运行命令   git push git@git.oschina.net:xxxxxxx/Demo.git     master

最后出现进度,上传速度,done,证实上传成功。

相关文章
相关标签/搜索