tongyi007 发表于 2018-1-16 06:18:16

oschina git 私有项目使用。。

工作流程

安装设置 git
  下载最新版本的git
  

http://git-scm.com/downloads  

  

  当你安装完成git的时候,你需要简单的配置一下,打开终端:

用户名
  第一步,你需要告诉git你的名字,这个名字会出现在你的提交记录中。
  

git config --global user.name "你的名字"  

  


Email
  然后是你的Email,同样,这个Email也会出现在你的提交记录中,请尽量保持此Email和您的Git@OSC的注册Email一致。
  

git config --global user.email "你的Email"  

  


Clone 和 Push
  Clone 项目
  

git clone http://git.oschina.net/xxxxxx/xxxxxx.git  

  

  创建特性分支
  

git checkout -b $feature_name  

  

  写代码,提交变更
  

git commit -am "My feature is ready"  

  

  将你的提交推送到 Git@OSC
  

git push origin $feature_name  

  

  在提交页面你可以查看你的变更,例如:
  http://git.oschina.net/oschina/git-osc/commit/f3dd1c5bae48fa4244e2595a39e750e5606dd9be

创建一个 pull request
  你可以fork任意的公开项目,当你修改了你fork的项目,你可以向源项目提交pull request。项目的作者在审阅过代码后可以决定是否将此变更应用到源项目。

SSH Keys
  SSH key 可以让你在你的电脑和 Git @ OSC 之间建立安全的加密连接。
  你可以按如下命令来生成sshkey
  

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/keys
  

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

  

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

ssh -T git@git.oschina.net  

  

  若返回
  

Welcome to Git@OSC, yourname!  

  

  则证明添加成功。
  然后在你的项目中添加钥匙。。。
  最后记得是使用ssh地址clone你的项目。。。
页: [1]
查看完整版本: oschina git 私有项目使用。。