我创建了一个新的本地 Git 仓库:
~$ mkdir projectname
~$ cd projectname
~$ git init
~$ touch file1
~$ git add file1
~$ git commit -m 'first commit'
有没有任何git命令可以创建一个新的远程仓库,并且从这里将我的提交推送到GitHub?我知道只需打开浏览器并转到创建新存储库,但如果有一种从CLI实现此操作的方法,我会很高兴。
我读了大量文章,但我发现没有一个提到如何使用git命令从CLI创建远程存储库。 Tim Lucas的不错的文章设置新的远程Git存储库是我找到的最接近的方法,但是GitHub不提供Shell访问。
git remote add origin https://github.com/github用户名/仓库名.git
将您的本地项目与GitHub关联。例如,命令应该长这样:git remote add origin https://github.com/arpitaggarwal/command-line-repo.git
。 - SherylHohman