推送克隆存储库时出错

时间:2012-02-25 01:49:34

标签: git github repository clone

我是git的新手,并且在尝试将克隆的存储库推送到我的在线存储库时遇到了问题。我创建了一个本地存储库,如下所示:

git config --global user.name "My Name"
git config --global user.email myemail
mkdir trash
cd trash
git init
touch test # Creates a file in git bash
git commit -m 'first commit'
git remote add origin git@github.com:user/trash.git
git push -u origin master

然后克隆了一个所需的存储库

git clone git@github.com:user/folder.git # Folder appears in my local repository

然后我把它推到我的项目中:

git add -A
git push -u origin master 

打印:“分支主数据设置为从原点跟踪远程分支主数据。一切都是最新的。”

但是,这还没有将我新克隆的存储库添加到我的在线存储库中。我错过了什么?谢谢,

麦克

编辑:

感谢您的投入 - 我的问题是我无法在我的本地和在线存储库中获取另一个人的存储库(我无法弄清楚如何将其克隆到我的本地存储库然后将其推送到网上)。以下是我发现的解决方案: - 转到https://github.com/user/project - 单击页面右上角的“Fork”。

将您的在线存储库复制(“克隆”)到您的本地计算机上:

 # Set up git

git config --global user.name "Your Name"
git config --global user.email your.email

# Clone your project from online to your local repository

cd desiered/directory
git clone git@github.com:username/project.git

1 个答案:

答案 0 :(得分:2)

你忘记了添加-A和push之间的提交:

git add -A
git commit -m 'foo'
git push -u origin master

或者你可以做

git commit -am 'foo'
git push -u origin master