我有一个非空目录(例如/ etc/something),其中包含无法重命名,移动或删除的文件.
我想将这个目录检查到git中.
我希望能够使用"git push"或类似的东西将此存储库的状态推送到远程存储库(在另一台计算机上).
这很简单,使用Subversion(目前我们使用Subversion),使用:
svn mkdir <url> -m <msg>
cd <localdir>
svn co <url> .
svn add <files etc>
svn commit -m <msg>
Run Code Online (Sandbox Code Playgroud)
什么是git等价物?
我可以"git clone"到一个空目录中,只需移动.git目录并使一切正常吗?
我创建了一个目录hello_git.在这个目录中,我创建了一个文件,hello_git.py打印出一个"Hello git!" 信息.
然后我hello_git在终端中创建了当前目录,并在该目录中一个接一个地输入以下命令:
git init
git add hello_git.py
git commit -m 'first commit'
git remote add origin git@github.com:githubaccountname/hello_git.git
Run Code Online (Sandbox Code Playgroud)
当我输入命令时,git push origin master我会被问到:
Enter passphrase for key '/home/myusername/.ssh/id_rsa':
Run Code Online (Sandbox Code Playgroud)
当我输入我的密码(使用成功验证ssh -T git@github.com)时,我得到了这个:
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)
我不知道这是否有帮助,但是:
git remote -v
Run Code Online (Sandbox Code Playgroud)
收益:
origin git@github.com:githubaccountname/hello_git.git (fetch)
origin git@github.com:githubaccountname/hello_git.git (push)
Run Code Online (Sandbox Code Playgroud)
我已经查看了类似帖子的答案,但似乎没有任何效果: