--- lang: ja-jp breaks: true --- # GitHub CLI forkせずに、cloneしたprivateリポジトリを作成 2021-05-03 ### `git clone`して、作成されたフォルダに移動 ```shell= $ git clone https://github.com/MicrosoftDocs/node-essentials.git $ cd node-essentials ``` ### `.git`フォルダを削除 ```shell= $ rm -rf .git ``` ### 新たにリポジトリを初期化して、コミットする。 ```shell= git init echo -e "node_modules\n*.swp\nobj/\nbin/\n*.o\n" > .gitignore git add . git commit -m 'initial commit.' ``` ### githubにprivateリポジトリを作成して`push`する。 ```shell= REPO_NAME=`pwd | awk -F"/" '{print $(NF-1)"_"$(NF-0)}'` gh repo create $REPO_NAME --confirm --description "" --private git push -u origin master ``` :::info リポジトリ名をディレクトリ名から自動的に作成する。 ``` * pwd | awk -F"/" '{print $(NF-1)"_"$(NF-0)}' * basename \`pwd\` ``` ::: ###### tags: `git` `GitHub` `GitHub CLI`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up