我正在尝试创建一个远程 git 存储库(我使用该--bare
选项进行了初始化)并将一些源文件推送到它。
我有一个本地 git repo 和一个裸远程:
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 "first import of 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:~$
本地 repo 中大约有 12 个 *.ipynb 文件没有被推送。我相当确定这是一个概念问题而不是语法问题,但我已经阅读并重新阅读了 O'Reilly Git 书中的远程章节,我很困惑。