How to add one repository to another repository on Github? I have one project workspace XXX and i have my own created repository YYY somewhere else, so i want to add that repo to that blank repo created.
Here is simple way I can think of
Clone the xxx repository
open it and delete .git folder
open terminal and type git init
type command git remote add origin GIT_URL_OF_YYY
add , commit and push
You could do this with simple two steps :
clone {current}
push {new}
A. clone {current} git clone
create local directory
open terminal
git clone ssh://john#example.com/path/to/my-project.git
cd my-project
B. push {new} git push <remote> <branch>
git remote add origin example.com/path/to/my-project.git
git push origin master
you may face an error of repo{s} timing, so.. you may need to fore pushing
and you may face some other problems then you will just run git add . git commit -m "first lanuch" git push -u origin master
Related
I am currently using flutter in Android studio and was wondering how to link a project to a private repo in android studio?
Btw this is a condensed self answer to myself.
cd <project folder>
git init
git add .
git remote add origin https://github.com/USERNAME/project.git
git fetch origin
git commit -m "My first commit"
git push -u origin master
Then in android studio
VCS -> Git -> Push
This question already has answers here:
How do I add files and folders into GitHub repos?
(12 answers)
Closed 2 years ago.
I have 2 Android App projects that I want to add to the same GitHub repo. I wish to create 2 folders in the repo and upload the app files to the corresponding folders. Any way that I can do it using Git CLI and Git Bash rather than uploading the files manually?
First of all,create a new repository from the github.
Then copy the repository ssh url or https url for the repository.
After that cd to the main directory such that the two sub folders are inside it
Then type the following in the terminal -
git init
git commit -m "first commit"
git remote add origin [url-for-github-repo]
git push -u origin master
If Your github url is git#github.com:AnishAralikatti/Android.git
git init
git commit -m "first commit"
git remote add origin git#github.com:AnishAralikatti/Android.git
git push -u origin master
I have run below commands in android studio terminal on 'development' branch.
git rm -r --cached .
git add .
git commit -m "commitXYZ"
after that when I checkout to another branch and coming back to 'development' branch again, only gitignore files is showing not other modules like 'app' etc
Please see the attached screenshot.
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?
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
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 init
ssh-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.
I'm running a remote Linode server - Debian 7.5 Profile (Latest 64 bit (3.16.5-x86_64-linode46))
A co-worker of mine already has an android application project locally on their machine.
I want to be able to transfer that project onto my server and adapt the git technology to it. So that it will enable me and the colleague to simultaneously work on the project.
How can I achieve this?
Are there any step by step tutorials on how to do this?
Thanks in advance
You might want to read this for using git on the server.
http://git-scm.com/book/en/v1/Git-on-the-Server
Tip. If you guys can use a shared folder (e.g., samba shared folder), just keep the common git repository there. Then you guys can clone it and push commits into the git not shared folder.
$ git clone samba_shared_folder_path
You can understand why it works after reading the above link.
Tip2, You can try the following at you local. (Just forget about 4-digit number)
a. make a local git repo and a commit
2037 mkdir common
2038 cd common/
2039 git init
2040 touch sample.txt
2041 git add sample.txt
2043 git commit -m "testing"
b. clone the commit.git into another folder
2044 cd ..
2045 git clone common my_common
2046 cd my_common/
2047 echo "new line" >> sample.txt
2048 git add sample.txt
2049 git commit -m "new commit from my_common"
c. push new commit from my_common(local) into common(remote)
2052 git push ../common HEAD:from_new_common
Just think about using a shared folder instead of common folder at your local.