使用Git上传本地项目到http://git.oschina.net

本文要解决的问题:

       已有http://git.oschina.net的帐号,别人将你加入到项目组中,并给你一个提交代码的地址:[email protected]  ,如何提交代码??

1.首先看一下自己是否有公钥, 在 我的资料-->SSH公钥  查看,如果没有,添加自己的SSH 公钥:


SSH key 可以让你在你的电脑和 Git @ OSC 之间建立安全的加密连接。

你可以按如下命令来生成sshkey

ssh-keygen -t rsa -C "[email protected]"
# Creates a new ssh key using the provided email
# Generating public/private rsa key pair...

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

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

复制

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6eNtGpNGwstc....

添加到使用Git上传本地项目到http://git.oschina.net_第1张图片

公钥里面,保存。名称自己定。

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

若返回

Welcome to Git@OSC, yourname! 

则证明添加成功。

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

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

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

4.运行命令 git pull [email protected]:xxxx/Demo.git 

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

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

7.运行命令   git push [email protected]:xxxxxxx/Demo.git     master

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

你可能感兴趣的:(代码管理工具)