简体   繁体   English

如何将Android Studio项目推送到远程GitLab存储库

[英]How to push an Android Studio Project to a remote GitLab Repository

I am coming from the eclipse/svn world and for a new android project with android studio I decided it might be a good time to learn more about GIT. 我来自eclipse / svn世界和android工作室的一个新的android项目,我认为这可能是了解更多关于GIT的好时机。 After some research I decided to install GitLab on my server in the same network, since it seems to perfectly fit my needs and I prefer to have the data on my server. 经过一番研究后,我决定在同一网络中的服务器上安装GitLab ,因为它似乎完全符合我的需求,我更喜欢在我的服务器上安装数据。 The installation was done fast and I was able to connect to the webinterface on the server from my local machine. 安装快速完成,我能够从本地计算机连接到服务器上的Web界面。

Now I wanted to push a prototype in form of an android project to my GitLab Repository on the server. 现在我想将一个android项目形式的原型推送到服务器上的GitLab Repository。 Here I started getting confused on how to start. 在这里,我开始对如何开始感到困惑。

First I installed GIT on my local machine and enabled it in my android studio project, and succeded to commit files (eventhough I wasn't really sure, where these files get commited to,.. does enabling git create a local repository for that project?). 首先我在我的本地机器上安装了GIT并在我的android studio项目中启用它,并成功提交文件(虽然我不太确定,这些文件被提交到哪里,...确实启用git为该项目创建本地存储库?)。

Ok, next I of course want these committed files to end up in a Repository of my GitLab remote server. 好的,接下来我当然希望这些提交的文件最终存放在我的GitLab远程服务器的存储库中。 I found this topic but unfortunately I did not understand how to exactly add my server as a remote host. 我找到了这个主题,但不幸的是我不明白如何将我的服务器完全添加为远程主机。

I tried using gitbash and used 我尝试使用gitbash并使用

git remote add origin https://[serverip]:[gitlabport]

but this did not seem to change anything. 但这似乎没有任何改变。 Whenever I commit (also tried commit and push) from UI there was no new repository on my GitLab Web Interface. 每当我从UI提交(也尝试提交和推送)时,我的GitLab Web界面上都没有新的存储库。

Using gitbash to push as suggested by Makoto with 使用gitbash推送Makoto建议

git push -u origin master

reveals the following error: 揭示以下错误:

"fatal: 'https://[serverip]:[gitlabport]/info/refs not valid: is this a git repository?

So I guess I need to let git remote add point to an already existing repository? 所以我想我需要让git remote add指向已经存在的存储库? And why does the Android Studio UI not reveal errors as well? 为什么Android Studio UI也不会显示错误? Is gitbash git push different from commit and push in the android studio UI? gitbash git push不同于提交并推入android studio UI吗?

https://[serverip]:[gitlabport] isn't enough as a remote url: you are missing the name of a repo. https:// [serverip]:[gitlabport]作为远程URL是不够的:你缺少一个repo的名字。

This would be better: 这会更好:

git remote set-url origin https://[serverip]:[gitlabport]/<reponame>

<reponame> should be the name of an empty repo declared through the GitLab web interface. <reponame>应该是通过GitLab Web界面声明的空repo的名称。

So it isn't an issue of protocol (https vs. ssh: https will work just fine here). 所以它不是协议问题(https与ssh:https在这里工作得很好)。
It is an issue of url (which should include the name of a repo) 这是url的问题(应该包括repo的名称)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将本地 android studio 项目推送到 master 分支现有文件夹中的 gitlab? - How can I push a local android studio project to gitlab in an existing folder in the master branch? 如果Maven存储库发布者删除其存储库,那么在Android Studio中具有远程库依赖项的项目会发生什么情况 - What happens to project with remote library dependency in android studio if maven repository publisher removes his repository Android Studio将标签推送到远程 - Android Studio push tags to remote 如何通过API禁用GitLab项目存储库? - How to disable GitLab project repository via API? 如何在新的 Android Studio 项目设置(2022)中添加存储库 maven? - How to add Repository maven in new Android Studio Project setup(2022)? Egit:如何将Eclipse项目(本地存储库)与远程存储库同步 - Egit: how to synchronize eclipse project ( local repository) with the remote repository 如何在不添加Remote的情况下将提交推送到git存储库? - How to push commit to git repository without adding Remote? Android Studio不允许我“安装存储库并同步项目” - Android Studio won't let me “Install repository and sync project” 使用 maven 存储库将 java 库添加到 Android Studio 项目 - Add java library to Android Studio project with maven repository 如何从远程存储库向我的Java项目添加Maven依赖关系? - How to add a Maven dependency from a remote repository to my Java project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM