我正在尝试创建一个远程git存储库(使用--bare
选项进行初始化),并将一些源文件推送到其中。
我有一个本地git存储库和一个裸远程存储库:
ubuntu@ip-LOCAL-IP:~/notebooks$ cat .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
[remote "nbcsm"]
url = ssh://ubuntu@ec2-RE-DA-CT-ED.compute1.amazonaws.com/home/ubuntu/notebooks/.git
fetch = +refs/heads/*:refs/remotes/nbcsm/*
我使用以下步骤创建本地仓库: 1.
git init
2. git add *.ipynb
3. `git commit -m "第一次导入IPython Notebooks"`然后,我通过使用vi编辑一个*.ipynb文件并运行
git status
来验证我的本地仓库是否跟踪了文件。Git确实看到了更改的文件。然而,当我执行
git push nbcsm master
时,推送似乎成功了,但是我远程计算机/实例上的目标目录为空(即它不包含我尝试推送到远程的文件)。ubuntu@ip-LOCAL-IP:~/notebooks$ git push nbcsm master
Enter passphrase for key '/home/ubuntu/.ssh/id_rsa':
Counting objects: 11, done.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 2.49 KiB, done.
Total 9 (delta 5), reused 0 (delta 0)
To ssh://ubuntu@ec2-ec2-RE-DA-CT-ED.amazonaws.com/home/ubuntu/notebooks/.git
7a50f44..295a4fa master -> master
ubuntu@ip-LOCAL-IP:~/notebooks$
验证文件不在远程服务器上:
ubuntu@ip-LOCAL-IP:~/notebooks$ ssh ubuntu@ec2-ec2-RE-DA-CT-ED.compute-1.amazonaws.com
Enter passphrase for key '/home/ubuntu/.ssh/id_rsa':
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-25-virtual x86_64)
* Documentation: https://help.ubuntu.com/
System information as of Tue Dec 18 16:46:23 UTC 2012
System load: 0.02 Processes: 63
Usage of /: 41.7% of 7.97GB Users logged in: 0
Memory usage: 12% IP address for eth0:REMOTE-IP
Swap usage: 0%
Graph this data and manage this system at https://landscape.canonical.com/
Get cloud support with Ubuntu Advantage Cloud Guest
http://www.ubuntu.com/business/services/cloud
*** /dev/xvda1 will be checked for errors at next reboot ***
ubuntu@REMOTE-IP:~$ sudo find /home/ubuntu/ -name "*.ipynb"
/home/ubuntu/notebooks/Untitled0.ipynb
ubuntu@ip-REMOTE-IP:~$
本地仓库中有大约12个*.ipynb文件没有被推送。我相当确定这是一个概念问题而不是语法问题,但我已经阅读并反复阅读了O'Reilly Git书籍中的远程章节,但我还是束手无策。