git init
git add .
git commit -m "first"
git push origin ritu
Run Code Online (Sandbox Code Playgroud)
(第二个是分支的名称)但它说
fatal: origin does not appear to be a git repository.
fatal: could not read from remote repository.
Please sure you have the correct access rights and the repository exists.
Run Code Online (Sandbox Code Playgroud)
您必须先添加远程,并且您可能还想先创建一个本地分支,所以完整的:
git init
git remote add origin <url>
# or, instead if init+remote: git clone <url>
git add ...
git commit
git branch ritu
git push origin ritu
Run Code Online (Sandbox Code Playgroud)
git init只会创建一个本地存储库。
您尚未定义任何指向远程副本的链接,因此该链接git push将不起作用。
取决于您的需要:
您只想保留项目的本地历史记录:您不需要使用任何远程副本,并且可以忽略该git push步骤。
您想与其他人共享此项目:您将需要创建一个可供其他人访问的远程存储库。
您的目的是处理现有项目:您应该首先克隆此现有项目,并找到某种方法将您的工作转移到此克隆上。
当您开始克隆现有存储库时,通常会获得带有远程副本的存储库,例如:
# this will create a local 'project/' repository,
# with all the history of the remote project,
# and, by default, git will keep the information :
# "'origin' is a shortcut for https://github.com/user/project"
git clone https://github.com/user/project
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7866 次 |
| 最近记录: |