Git推向私人仓库 [英] Git pushing to a private repo
问题描述
我一直在通过Web应用程序在本地工作,我被要求将其推送到仅为此项目创建的空白私人仓库(仅读取我的文件).我是git
的新手,但在这样做时遇到了麻烦.
I have been working on my local on a web app and I was ask to push it to an empty(only read me file on it) private repo created just for this project. I'm new to git
and I'm having trouble doing so.
有人可以告诉我我在做什么错吗?
Can someone tell me what am I doing wrong?
我首先使用命令行导航到本地应用程序的主文件夹,然后初始化git.之后,我尝试使用以下命令克隆远程存储库:
I first navigate to the main folder of the app in my local using command line and initialize git. After, I try cloning the remote repo with:
git clone git://github.com/somename/Web-App.git
但是我得到了错误:
克隆到"Web-App"中...致命:远程错误:存储库不正确 找到了.
Cloning into 'Web-App'... fatal: remote error: Repository not found.
我知道存储库存在.我是否真的需要先从该远程服务器克隆或提取,还是有办法直接推送到该存储库?
I know the repo is there.. Do I actually need to clone or pull from that remote first or is there a way to just push to that repo.
同样,我要做的就是将本地文件保存到我可以访问的特定存储库中.
Again, all I'm trying to do is to get the files that I have in my local pushed to a specific repo that I was given access to.
我将非常感谢您的帮助.
I will really appreciate any help.
推荐答案
让我们说"yourWebApp"是您拥有本地Web应用程序的文件夹.将其更改为目录
Let us say 'yourWebApp' is the folder you have your local web app. Change it to the directory
cd 'yourWebApp'
在文件夹中初始化git
Init git in the folder
git init
现在将您的github网址添加为远程
git remote add origin git://github.com/somename/Web-App.git
来源是您网址的简称
现在从github存储库中提取自述文件
Now pull the read me file from the github repo
git pull origin master
现在将您的Web应用程序推送到github存储库
Now push your web app to the github repository
git push origin master
这里假定您位于 master (默认分支)
Here it is assumed that you are in your master, the default branch
在此处拉取自述文件对于将自述文件与本地工作合并是必要的.如果您的github存储库为空,则可以跳过拉取,直接将其推送到您的github存储库.
Here pulling your readme files is necessary to merge the readme file with your local work. If your github repository is empty, you can skip the pull and directly push to your github repository.
另一方面,如果要使用克隆,则无需进行初始化,因为克隆会自动在目录中设置git. 克隆还会设置您的远程git网址.在这种情况下,您的工作流程应为
On the other hand, if you want to use clone, there is no need to init as clone automatically sets up git in the directory. clone also sets your remote git url. In that case, your workflow should be
clone -> push
这篇关于Git推向私人仓库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!