I have a project in android studio that i want to commit to a gitlab repository. I have a link for this repository. What do i need to do, step for step, to add this project to said repository?
2 Answers
First you have to guarantee that this project is already a git repository on your local machine.
You can do this by checking if there's a folder .git in the directory. If there's none, do the following command:
# create a git repository on the current directory
git init
After that you need to make your repository point to gitlab
git remote add origin "url from gitlab"
Add files for your initial commit
git add -A
Commit the files
git commit -m "your initial commit message"
Push all the files to the remote(gitlab)
git push -u origin master
More information of each command can be found typing:
man git command
# example
man git push
1 Comment
For using gitlab when you have ssh keys and also your ssh key have passphrase, you have to follow instructions as follow (don’t forget to upload your public key to gitlab)(also you must use a private key which its format is openssh):
- Have your project folder and its files.
- Have Git Bash installed on your system.
- Using git bash, go to your project directory.
git config --global user.name "your-name"git config --global user.email "your-email-address"git initssh-agent bash -c 'ssh-add “private-key-local-address”; git remote add origin “online-repo-address”’(will be asked for passphrase)git add .git commit -m “initial commit”ssh-agent bash -c 'ssh-add “private-key-local-address”; git push -u origin master'(will be asked for passphrase)
For further commits, you can commit changes in android studio and then repeat step 10 to push them to gitlab servers.