2017-02-15 40 views
1

我想使用ssh密鑰提供的無密碼訪問機會來創建新的存儲庫,而不是通過每次輸入用戶名和密碼來打開瀏覽器並登錄git託管服務提供商。如何通過ssh創建新的存儲庫?如何通過ssh創建新的存儲庫?

+2

[我的工具問題去了哪裏?](http://meta.softwareengineering.stackexchange.com/questions/7253/where-does-my-tool-question-go) – gnat

+0

@gnat:它不是關於工具,這是關於如何創建新的存儲庫 –

+4

@IgorLiferenko:「該工具」是GitHub。這個網站是關於軟件工程,而不是工具支持。 –

回答

1

GitHub API確實爲項目創建提供了機制,目前處於alpha狀態。見https://developer.github.com/v3/projects/#create-a-repository-project

+0

這不是我想要的。您的鏈接解釋瞭如何通過http進行操作,該操作需要輸入登錄名和密碼。有沒有ssh的支持? –

+0

是否有任何提供ssh訪問來創建免費存儲庫的git託管提供商?它不一定是github。 –

+0

@IgorLiferenko - 我必須問爲什麼__create__回購通過SSH? - 每個存儲庫只需要執行一次,所以沒有太大困難,一旦創建完成,您可以通過ssh完全訪問。 –

0

我用這個/usr/local/bin/github

#!/bin/dash 

# Create a personal access token here 
# 
#  https://github.com/settings/tokens 
# 
# and make sure it has the 'repo' scope. 

TOKEN=`cat /home/user/github_token` 
REPO=$2 
curl -s -XPOST -H 'Authorization: token '$TOKEN https://api.github.com/user/repos -d '{"name":"'$REPO'"}'|egrep -w 'already|"name":'|grep -o '.*[^,]'|cut -d: -f2|perl -pe 's/^ "(.*)"/$1/;s/name already exists on this account/already exists/'|perl -pe "s/$REPO/successfully created/" 

它運行爲github init myrepo。從CLI創建和分支項目很有用。