2016-04-13 33 views
1

我需要一个bash code witch自动将一个文件夹从Openshift RHC服务器上传到github.com站点。自动从openshift rhc上传到github?

所以我成功将SSH的SSH密钥添加到Github上。我可以通过这个代码插入一个文件夹全手动Github的服务器:

echo "# openshift-test23" >> README2.md 
git init 
#git add README2.md 
git add . 
git config --global user.name "soheilpaper" 
#git config --global user.email [email protected] 
#git commit --amend --reset-author 
git commit -a -m "first commit" 
git push origin master 
Username for 'https://github.com': xyz 
Password for 'https://[email protected]': 

但是当我想写一个代码来自动在一个文件夹从Openshift RHC上传至Github上,需要通过此手动输入用户名和密码代码:

$ git push origin master 
Username for 'https://github.com': xyz 
Password for 'https://[email protected]': 

所以我怎么能绕过它在openshift RHC Linux服务器?

非常感谢。

回答

0

我发现这个代码的答案:

echo "# openshift-test23" >> README2.md 
    git init 

    #git add README2.md 
    git add . 
    git config remote.origin.url https://Username:[email protected]/Username/openshift-test 
    #git commit --amend --reset-author 
    git commit -a -m "first commit" 


    git remote add origin https://github.com/xxx/openshift-test.git 
    git config remote.origin.url https://Username:[email protected]//openshift-test 

    git push -u origin master